<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <!--头部固定引用-->
    <meta charset="utf-8">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />

    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/icon-font.css">
    <link rel="stylesheet" href="../../css/info-detail.css">
    <link rel="stylesheet" href="../../css/commentDetail.css">
    <!--固定引用结束,自定义引用添加在下面-->
    <title>财讯详情</title>
    <!--页面样式添加在这里，多看看base。css里面的公共样式，大部分常用的都有，避免使用独立css文件为单独页面设置样式，避免随意添加样式到公共样式-->
    <style>
      .title {
        width: 100%;
        text-align: center;
        font-weight: 700;
      }
      .footers {
        width: 100%;
        height: 0.5rem;
        text-align: center;
        opacity: .7;
        font-size: 0.2rem;
      }

      .info-detail-user {
        text-align: center;
      }

      .info-detail-fujian {
        /* color: black; */
        font-weight: 700;
        text-decoration:none;
        padding-left: 0.4rem;
      }

      .info-detail-fujian img {
        width: 0.3rem;
        height: 0.3rem;
        vertical-align: -1px;
      }

      .info-detail-content-lastText {
        /* background-color: #f8f8f8; */
        padding: 0.3rem;
        border-radius: 0.1rem;
        /* color: #a4a4a4; */
        margin: 0.2rem 0.4rem 0.48rem 0.4rem !important;
      }

      .ratios {
        color: #ffa500;
      }
        .charts {
          width: 100%;
          height: 6rem;
        }
        .industry-data-table {
            width: 100%;
            max-width: 100%;
            border-collapse: collapse;
        }

        .tbody {
          overflow: auto;
        }

        /* .industry-data-first {
            border-bottom: 1px solid #f6f6f6;
            color: rgba(34, 34, 34, 0.6);
        } */

        .industry-first-td {
            width: 2rem;
            max-width: 2rem;
        }

        .industry-data-tr {
            border-bottom: 1px solid #f6f6f6;
            color: #222222
        }

        .industry-data-pj {
          width: 3rem;
        }

        .info-detail-blank1 {
          height: .3rem;
        }
    </style>
</head>
<!--尽量不要在body上添加样式，除了背景色-->
<body>
<div>
    <!--具体代码-->

    <!-- 头部 -->
    <div class="info-detail-header">
        <div class="header-left">
            <img src="../../images/allPic/jiantou.png" alt="" onclick='closeWindow()' class="headerimg">
        </div>
        <div class="header-title">
            <!-- 我是文章的主标题哈哈哈哈哈 -->
        </div>
        <div class="header-right flex-row">
            <div class="info-detail-play-area flex-column align-items-center" style="width:1rem;display:none">
                <div class="pos-r" style="left: -0.1rem">
                    <div class="info-detail-no-play">
                        <img class="info-detail-erji" src="../../images/details/info-detail-erji.png">
                        <img class="pos-a"  src="../../images/details/info-detail-yp.png" style="height:10px;width:18px;top: -0.15rem;left: 0.16rem;"/>
                    </div>
                    <div class="info-detail-no-play" style="display: none">
                        <div class="flex-column align-items-center justify-content-center" style="height: 16px;width: 16px;background-color: #C7000B;border-radius: 20rem;">
                            <img style="height:8px;width:8px;" src="../../images/allPic/yibofang.gif"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="flex-row justify-content-end" style="width:0.5rem; margin-right: 10px;" onclick="report()">
                <img style="height:0.36rem;width:0.36rem;" src="../../images/jubao.jpg"/>
            </div>
            <div class="flex-row" style="width: 0.5rem;">
                <img src="../../images/allPic/fenxiang.png" alt="" onclick="goShare()" class="headerimg1">
            </div>
        </div>
    </div>

    <!-- 内容 -->
    <div class="fixed-content">
      <div class="info-detail-content">
        <div class="partOne">
        </div>
        <!-- 标题来源 -->
        <div class="partThree"></div>
        <div class="info-detail-blank1"></div>


        <!-- 内容 -->
        <div class="partTwo"></div>

      </div>

    <!-- 留白 -->
      <div class="info-detail-blank"></div>

    <!-- 评论 -->
      <div class="info-detail-comment">
        <div class="info-detail-comment-title">
        </div>
        <div class="info-detail-comment-content">
            <ul>
            </ul>
        </div>
      </div>
    </div>

    <!-- 底部 -->
    <div class="info-detail-footer level1">
        <input type="text" placeholder="" class="commentInpt">
        <div style='display:inline-block;vertical-align: middle;' class="mainfooter">
        </div>
    </div>

   </div>
</body>
<!--下面五个文件为固定引用，自己根据情况调整路径，不要跟换引入顺序，其他引用添加在后面-->
<script src="../../js/dict.js"></script>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/checkJsBridge.js"></script>
<script src="../../js/utils.js"></script>
<script src="../../js/api.js"></script>
<script src="../../js/icon-font.js"></script>
<script src="../../js/echarts.min.js"></script>
<!--protobuf-->
<script src="../../js/protobuf.min.js"></script>
<script src="../../js/proto.js"></script>
<!--固定引用结束-->
<!--避免一个页面包含过多功能，减少js重绘页面，推荐分功能，分页面-->
<script>
  let level = 1 // 1:一级评论 2:二级评论
  let commentObjectId // infoID
  let funcCode
  let isopencomment
  let infoType
  let token
  //分享的标题和主题内容和图片
  let shareImgUrl // 资讯分享图
  let sharetitle
  let sharecontent
  let shareimg
  let templateId
  let templateShareUrl // 画报路径
  //初始关注状态
  let followStatus
  let pageNum = 1
  //音频初始状态
  let vedioStatus = '0'
  //是否可评论
  let isComment = ''
  // 存储股票关键词
  let rateList = []
  //涨跌幅的结果
  let result
  // 作者简介
  let characterDesc

  /*固定页面初始化方法，用于替代$(function(){}),param为url参数，Object类型*/
  function initPage(params) {
    commentObjectId = params.infoId || '52a48b26e4df47e79799a6496ad9b698'
    // commentObjectId = '52a48b26e4df47e79799a6496ad9b698'
    infoType = params.infoType || '10'
    // infoType = '10'
    funcCode = params.funcCode

    //设置深色模式
    if (configColorType === '1') {
      $('.headerimg').attr('src', '../../images/allPic/blackfanhui.png')
      $('.headerimg1').attr('src', '../../images/allPic/blackfenxiang.png')
      $('.info-detail-zt').attr('src','../../images/details/info-detail-zts.png')
      $('.info-detail-erji').attr('src','../../images/details/info-detail-erjis.png')
      bridgeUtils.loadCss('../../css/theme/default/black.css')
    } else {
      bridgeUtils.loadCss('../../css/theme/white/white.css')
      $('.headerimg').attr('src', '../../images/allPic/jiantou.png')
      $('.headerimg1').attr('src', '../../images/allPic/fenxiang.png')
      $('.info-detail-zt').attr('src','../../images/details/info-detail-zt.png')
      $('.info-detail-erji').attr('src','../../images/details/info-detail-erji.png')
    }

    if (params.isopencomment) {
      isopencomment = params.isopencomment
    } else {
      isopencomment = '0'
    }
    getinfoDetail(params)
    // getRecommentList(params)
    $('.info-detail-comment-content ul').empty()
    footerStatus(params)
    // getcomment({'infoId':params.infoId,'pageNum':pageNum})
    //页面加载获取token用于判断是否可以评论或者点赞
    jsBridge.getData('token').then(res => {
      // token = res
      token = '288d981cc8ce386c5764c942a5d9ab9f'
    })

    setTimeout(function () {
      //获取音频初始状态
      jsBridge.getPlayingItem().then(res => {
        let id = res.id
        if (id && id === params.infoId) {
          $('#yiplay').show()
          $('#noplay').hide()
          $('.info-detail-no-play').hide()
          $('.info-detail-no-play').eq(1).show()
        } else {
          $('#yiplay').hide()
          $('#noplay').show()
          $('.info-detail-no-play').hide()
          $('.info-detail-no-play').eq(0).show()
        }
      })
    }, 500)

  }

  // function reLoadPage(params) {
  //   jsBridge.getData('token').then(res => {
  //     token = res
  //     // token = '3de7dae4593ccf0d86b0a6230fb23e99'
  //   })
  //   $('.info-detail-comment-content ul').empty()
  //   // getRecommentList({'funcCode': funcCode, 'infoId': commentObjectId})
  //   pageNum = 1
  //   getcomment({'infoId': commentObjectId, 'pageNum': pageNum})
  // }
  // 获取生成的画报图片地址
  // function getshareUrl (params) {
  //   Server.shareUrl.getShareUrl({
  //     'infoId': params.infoId,
  //     'templateId': params.templateId ? params.templateId : '1'
  //   }).then(res => {
  //     templateShareUrl = res.data.url
  //   })
  // }

  //点击文章里面的举报
  function report() {
      jsBridge.showReportDialog({infoId: commentObjectId, infoType:infoType})
  }

  //获取财讯详情页面
  function getinfoDetail(params) {
    Server.financialNews.getFinancialDetail({'infoId': params.infoId}).then(res => {
    // Server.financialNews.getFinancialDetail({'infoId': '52a48b26e4df47e79799a6496ad9b698'}).then(res => {
      res.data.editorData = JSON.parse(res.data.editorData)
      $('.partOne').empty()
      $('.partTwo').empty()
      $('.partThree').empty()
      $('.mainfooter').empty()
      $('.iconBox1').empty()
      // $('.seeAllIcon').empty()
      // alert(JSON.stringify(res.data.newContent))
      if (res.code === 0) {
        //分享标题和对应的内容
        sharetitle = res.data.mainTitle
        templateId = res.data.templateId
        // console.log('获取infoID:', params, templateId)
        //去掉富文本带过来的&nbsp,避免分享的时候出现
        // sharecontent = res.data.trailContent.replace(/&nbsp;/g, '')
        // alert(sharecontent)
        shareimg = res.data.coverImgUrl
        shareImgUrl = res.data.shareImgUrl
        //刷新原生页面的阅读数
        let readCount = res.data.readCnt
        jsBridge.updateStatus({'type': 'zixun', 'name': 'read', 'infoId': commentObjectId, 'value': readCount})
        //刷新H5得资讯列表页面
        jsBridge.updateStatus({'type': 'refresh', 'name': 'refresh', 'infoId': commentObjectId, 'value': '2'})
        //判断是否可评论,即是否显示评论列表
        isComment = res.data.isComment
        if (isComment === '0') {
          // return false
          $('.info-detail-comment-title').hide()
          $('.commentInpt').attr('disabled', true)
          $('.commentInpt').attr('placeholder', '暂不支持评论')
        } else {
          $('.commentInpt').attr('placeholder', '说说你的看法')
          getcomment({'infoId': commentObjectId, 'pageNum': pageNum})
        }
        let data = res.data
        let funcCode = res.data.funcCode

        //修改时间
        let creatTime = data.createDttm * 1000
        let nowTime = +new Date().valueOf() // 获取当前时间
        let year = new Date(creatTime).getFullYear() // 获取年
        // 获取月
        let month = new Date(creatTime).getMonth() + 1 < 10 ? '0' + (new Date(creatTime).getMonth() + 1) : new Date(creatTime).getMonth() + 1
        // 获取天
        let day = new Date(creatTime).getDate() < 10 ? '0' + new Date(creatTime).getDate() : new Date(creatTime).getDate()
        // 获取小时
        let hour = new Date(creatTime).getHours() < 10 ? '0' + new Date(creatTime).getHours() : new Date(creatTime).getHours()
        // 获取分钟
        let minute = new Date(creatTime).getMinutes() < 10 ? '0' + new Date(creatTime).getMinutes() : new Date(creatTime).getMinutes()
        if (nowTime - creatTime < 30 * 60 * 1000) {
          if (nowTime - creatTime < 1 * 60 * 1000) {
            data.createDttm = '刚刚'
          } else {
            data.createDttm = parseInt((nowTime - creatTime) / 1000 / 60) + '分钟前'
          }
        } else if (nowTime - creatTime < 24 * 60 * 60 * 1000) {
          if (nowTime - creatTime < 60 * 60 * 1000) {
            data.createDttm = '1小时前'
          } else {
            data.createDttm = parseInt((nowTime - creatTime) / 1000 / 60 / 60) + '小时前'
          }
        } else if (new Date().getDate() - new Date(creatTime).getDate() == 1 && new Date().getMonth() == new Date(creatTime).getMonth() && new Date().getFullYear() == new Date(creatTime).getFullYear()) {
          data.createDttm = '昨天' + hour + ':' + minute
        } else {
          data.createDttm = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
        }

        // 图表的颜色
        const color = ['#8dadda', '#ffda9c', '#86d6d9']
        const color1 = ['#faa198', '#85a5ff', '#ffc53d', '#a8e0fb', '#777bf6', '#e8b9d8', '#86d6d9', '#ffda9c', '#8dadda']
        const color2 = configColorType === '1' ? 'rgba(206, 206, 206, .5)' : 'rgba(34,34,34,0.45)'
        const axisLine = {
          lineStyle:{
            color: color2
          }
        }
        const  pageTextStyle = {
          color: color2
        }
        const splitLine = {
          show: true,
          lineStyle:{
            color: color2
          }
        }
        const  axisTick = {
          show: false
        }
        const grid = {
          top: '2%',
          left: '3%',
          right: '6%',
          bottom: '8%',
          containLabel: true,
        }
        const axisLabel = {
          textStyle: {
            color: color2
          },
          // formatter: function (val) {
          //   if (val > 0) return val.toFixed(2)
          //   return val
          // }
        }
        const axisLabelx = {
          textStyle: {
            color: color2
          },
        }
        const legend = {
          icon: 'roundRect',
          bottom: 0,
          type: 'scroll',
          itemWidth: 10,
          itemHeight: 10,
          textStyle: {color: color2, fontSize: '12', lineHeight: '12'},
          pageTextStyle: {
            color: color2
          }

        }

        // 标题
        let partThree =
          `<div class="info-detail-content-title">
              <span>${data.mainTitle}</span>
        </div>

        <div class="info-detail-content-subtitle">
          <span>中国证券报·中证网</span>
          <span>${data.createDttm}</span>
        </div>`
        // 内容
        let arr = data.editorData
        console.log(arr, 'arr')
        let content = ``
        // for (let index = 0; index < arr.length; index++) {
        //   if(arr[index].type === 'paragraph' || (arr[index].type === 'algo-result' && arr[index].secondType === 'paragraph')) {
        //     content += `
        //     <div>${arr[index].content}</div>
        //     `
        //   }
        //   if(arr[index].type === 'algo-result' && arr[index].url) {
        //     content += `
        //     <div>
        //       <img src=${arr[index].url} alt="">
        //     </div>
        //     `
        //   }

        //   // 渲染单独的图表
        //   if (arr[index].type === 'chart') {
        //     let myChart = {}
        //     if (arr[index].data.length === 1) {
        //       content += `
        //         <div class="chart" id="charts-${index}">
        //           <div id="chart${index}" class="charts"></div>
        //         </div>
        //         `
        //       let obj = arr[index].data[0]
        //       let rightMax
        //       let rightMin
        //       let leftMax
        //       let leftMin
        //       obj.series.forEach(i => {
        //         if (i.type === 'line') {
        //           i.symbol = 'none'
        //         }
        //         if (i.stack && i.type === 'line') {
        //           i.areaStyle = {}
        //         }
        //         if (i.name.indexOf('右轴') !== -1) {
        //           let data1 = i.data.map(it => {
        //             if (it === 'undefined') {it = '0.00'}
        //             return Number(it)
        //           })
        //           // 右轴的最大值
        //           rightMax = Math.max(1,...data1) || 1
        //           rightMin = Math.min(0,...data1) || 0
        //           i.yAxisIndex = 1
        //         } else if (i.name.indexOf('左轴') !== -1 ) {
        //           let data2 = i.data.map(it => {
        //             if (it === 'undefined') {it = '0.00'}
        //             return Number(it)
        //           })
        //           // 左轴的最大值
        //           leftMax = Math.max(1,...data2) || 1
        //           leftMin = Math.min(0,...data2) || 0
        //           i.yAxisIndex = 0
        //         }
        //       })
        //       const radio = (leftMax - leftMin) / (rightMax - rightMin)
        //       let y1Max
        //       let y1Min
        //       let y2Max
        //       let y2Min
        //       if (leftMax < rightMax * radio) {
        //         y1Max = rightMax * radio
        //         y2Max = rightMax
        //       } else {
        //         y1Max = leftMax
        //         y2Max = leftMax / radio
        //       }
        //       if (leftMin < rightMin * radio) {
        //         y1Min = leftMin
        //         y2Min = leftMin / radio
        //       } else {
        //         y1Min = rightMin * radio
        //         y2Min = rightMin
        //       }

        //       setTimeout(() => {
        //         let asd =  `<div class="footers">${arr[index].dataSource}</div>`
        //         $(`#charts-${index}`).append(asd)
        //         myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
        //         // let obj = arr[index].data[0]
        //         $(`#charts-${index}`).before(`<div class="title">${obj.title}</div>`)
        //         let option = {
        //           color: obj.series.length >= 4 ? color1 : color,
        //           tooltip: {
        //             trigger: 'axis',
        //             confine: true,
        //           },
        //           grid: {
        //             top: '2%',
        //             left: '3%',
        //             right: '4%',
        //             bottom: '8%',
        //             containLabel: true,
        //           },
        //           xAxis: [{
        //             data: obj.x,
        //             axisLabel: {
        //               textStyle: {
        //                 color: color2
        //               }
        //             },
        //             axisLine
        //           }],
        //           yAxis: [
        //             {
        //               max: y1Max || y1Max === 0 ? (y1Max * 1.2).toFixed(0) : null,
        //               min: y1Min || y1Min === 0 ? (y1Min * 1.2).toFixed(0) : null,
        //               splitNumber: 4,
        //               title: {
        //                 text: '',
        //                 style: {
        //                   color: color2
        //                 }
        //               },
        //               axisLabel: {
        //                 textStyle: {
        //                   color: color2
        //                 },
        //               },
        //               scale: true,
        //               splitLine,
        //               axisTick,
        //               axisLine: {
        //                 show: false,
        //                 lineStyle: {
        //                   color: color2
        //                 }
        //               },
        //             },
        //             {
        //               max: y2Max || y1Max === 0  ? (y2Max * 1.2).toFixed(0) : null,
        //               min: y2Min  || y1Min === 0 ? (y2Min * 1.2).toFixed(0) : null,
        //               splitNumber: 5,
        //               title: {
        //                 text: '',
        //                 style: {
        //                   color: color2
        //                 }
        //               },
        //               axisLabel: {
        //                 textStyle: {
        //                   color: color2
        //                 },
        //               },
        //               scale: true,
        //               splitLine: {show: false},
        //               axisTick,
        //               axisLine: {
        //                 show: false,
        //                 lineStyle: {
        //                   color: color2
        //                 }
        //               },
        //             }],
        //           legend: {
        //             pageTextStyle,
        //             icon: 'circle',
        //             bottom: 0,
        //             type: 'scroll',
        //             itemWidth: 10,
        //             itemHeight: 10,
        //             textStyle: {
        //               color: color2,
        //               fontSize: '12',
        //               lineHeight: '12'
        //             }
        //           },
        //           series: obj.series
        //         }
        //         myChart[`myChart${index}`].setOption(option, true)
        //       }, 1000)
        //     }

        //     if (arr[index].data.length > 1 && arr[index].secondType !== 'kLine' && arr[index].secondType !== 'table') {
        //       const data = arr[index].data
        //       for (let ind = 0; ind < data.length; ind++) {
        //         content += `
        //         <div class="chart" id="charts-${index}-${ind}">
        //           <div id="chart${index}-${ind}" class="charts"></div>
        //         </div>
        //         `
        //         let rightArr = [] // 记录右轴 出现多数据取最大值
        //         let  leftArr = [] // 记录左轴 出现多数据取最大值
        //         let rightMax1
        //         let rightMin1
        //         let leftMax1
        //         let leftMin1
        //         data[ind].series.forEach((i, index1) => {
        //           if (i.type === 'line') {
        //             i.symbol = 'none'
        //           }
        //           if (i.stack && i.type === 'line') {
        //             i.areaStyle = {}
        //           }
        //           if (i.name.indexOf('右轴') !== -1) {
        //             rightArr = rightArr.concat(i.data)
        //             let data11 = rightArr.map(it => {
        //               if (it === 'undefined') {it = '0.00'}
        //               return Number(it)
        //             })
        //             // 右轴的最大值
        //             rightMax1 = Math.max(1,...data11) || 1
        //             rightMin1 = Math.min(0,...data11) || 0
        //             // Math.max(...i.data)
        //             i.yAxisIndex = 1
        //           } else if (i.name.indexOf('左轴') !== -1 ) {
        //             leftArr = leftArr.concat(i.data)
        //             let data22 = leftArr.map(it => {
        //               if (it === 'undefined') {it = '0.00'}
        //               return Number(it)
        //             })
        //             // 左轴的最大值
        //             leftMax1 = Math.max(1,...data22) || 1
        //             leftMin1 = Math.min(0,...data22) || 0
        //             i.yAxisIndex = 0
        //           }

        //           // else if (i.stack === 'total' && i.type === 'bar') {
        //           //   leftArr = leftArr.concat(i.data) // 出现多个对用y轴需要合并取最大值
        //           //   console.log(leftArr, 'leftArr')
        //           //   let data22 = leftArr.map(it => {
        //           //     if (it === 'undefined') {it = '0.00'}
        //           //     return Number(it)
        //           //   })
        //           //   // 左轴的最大值
        //           //   leftMax1 = Math.max(1,...data22) || 1
        //           //   leftMin1 = Math.min(0,...data22) || 0
        //           //   console.log(leftMax1,leftMin1, 'leftArr')
        //           //   i.yAxisIndex = 0
        //           // }
        //         })
        //         if (data[ind].title === '历年存货变动情况') {
        //           data[ind].series.forEach(i => {
        //             if (i.name.indexOf('右轴') !== -1 ) {
        //               console.log(i, 'i')
        //               rightArr = rightArr.concat(i.data)
        //               let data11 = rightArr.map(it => {
        //                 if (it === 'undefined') {it = '0.00'}
        //                 return Number(it)
        //               })
        //               // 右轴的最大值
        //               rightMax1 = Math.max(1,...data11) || 1
        //               rightMin1 = Math.min(0,...data11) || 0
        //               // Math.max(...i.data)
        //               i.yAxisIndex = 1
        //             } else {
        //               leftArr = leftArr.concat(i.data) // 出现多个对用y轴需要合并取最大值
        //               let data22 = leftArr.map(it => {
        //                 if (it === 'undefined') {it = '0.00'}
        //                 return Number(it)
        //               })
        //               // 左轴的最大值
        //               leftMax1 = Math.max(1,...data22) || 1
        //               leftMin1 = Math.min(0,...data22) || 0
        //               i.yAxisIndex = 0
        //             }

        //           })

        //         }

        //         const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
        //         let y1Max1
        //         let y1Min1
        //         let y2Max1
        //         let y2Min1

        //         if (leftMax1 < rightMax1 * radio1) {
        //           y1Max1 = rightMax1 * radio1
        //           y2Max1 = rightMax1
        //         } else {
        //           y1Max1 = leftMax1
        //           y2Max1 = leftMax1 / radio1
        //         }
        //         if (leftMin1 < rightMin1 * radio1) {
        //           y1Min1 = leftMin1
        //           y2Min1 = leftMin1 / radio1
        //         } else {
        //           y1Min1 = rightMin1 * radio1
        //           y2Min1 = rightMin1
        //         }
        //         setTimeout(() => {
        //           let asd =  `<div class="footers">${arr[index].dataSource}</div>`
        //           $(`#charts-${index}-${ind}`).append(asd)
        //           myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
        //           let obj = arr[index].data[0]
        //           $(`#charts-${index}-${ind}`).before(`<div class="title">${data[ind].title}</div>`)
        //           let option = {
        //             color: data[ind].series.length >= 4 ? color1 : color,
        //             tooltip: {
        //               trigger: 'axis',
        //               confine: true,
        //             },
        //             grid: {
        //               top: '2%',
        //               left: '3%',
        //               right: '4%',
        //               bottom: '8%',
        //               containLabel: true,
        //             },
        //             xAxis: [{
        //               data: data[ind].x,
        //               axisLabel: {
        //                 textStyle: {
        //                   color: color2
        //                 }
        //               },
        //               axisLine

        //             }],
        //             yAxis: [
        //               {
        //                 max: y1Max1 || y1Max1 === 0  ? (y1Max1 * 1.2).toFixed(0) : null,
        //                 min: y1Min1  || y1Min1 === 0 ? (y1Min1 * 1.2).toFixed(0) : null,
        //                 // max: null,
        //                 // min:  null,
        //                 title: {
        //                   text: '',
        //                   style: {
        //                     color: color2
        //                   }
        //                 },
        //                 axisLine: {
        //                   show: false,
        //                   lineStyle: {
        //                     color: color2
        //                   }
        //                 },
        //                 axisLabel: {
        //                   textStyle: {
        //                     color: color2
        //                   },
        //                 },
        //                 scale: true,
        //                 splitLine
        //               },{
        //                 max: y2Max1 || y2Max1 === 0  ? (y2Max1 * 1.2).toFixed(0) : null,
        //                 min: y2Min1  || y2Min1 === 0 ? (y2Min1 * 1.2).toFixed(0) : null,
        //                 title: {
        //                   text: '',
        //                   style: {
        //                     color: color2
        //                   }
        //                 },
        //                 axisTick: {
        //                   show: false,
        //                 },
        //                 axisLine: {
        //                   show: false,
        //                   lineStyle: {
        //                     color: color2
        //                   }
        //                 },
        //                 axisLabel: {
        //                   textStyle: {
        //                     color: color2
        //                   },
        //                 },
        //                 scale: true,
        //                 splitLine: {show: false}
        //               }],
        //             legend: {
        //               pageTextStyle,
        //               icon: 'circle',
        //               bottom: 0,
        //               type: 'scroll',
        //               itemWidth: 10,
        //               itemHeight: 10,
        //               textStyle: {color: color2, fontSize: '12', lineHeight: '12'}
        //             },
        //             series: data[ind].series
        //           }
        //           myChart[`myChart${index}`].setOption(option, true)
        //         }, 1000)
        //       }
        //     }

        //     if (arr[index].secondType === 'kLine') {
        //       const upColor = '#ec0000'
        //       const upBorderColor = '#8A0000'
        //       const downColor = '#00da3c'
        //       const downBorderColor = '#008F28'
        //       content += `
        //         <div class="chart" id="charts-${index}">
        //           <div class="title">${arr[index].secuabbr}${arr[index].code} | 日K</div>
        //           <div id="chart${index}" class="charts"></div>
        //         </div>
        //         `
        //       setTimeout(() => {
        //         myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
        //         let option = {
        //           color: ['#faa198', '#85a5ff', '#ffc53d', '#a8e0fb', '#777bf6', '#e8b9d8', '#86d6d9', '#ffda9c', '#8dadda'],
        //           tooltip: {
        //             show: false,
        //             // trigger: 'axis',
        //             // confine: true,
        //           },
        //           grid: {
        //             top: '2%',
        //             left: '3%',
        //             right: '4%',
        //             containLabel: true,
        //           },
        //           xAxis: [{
        //             data: arr[index].data.map(i => i.tradingday),
        //             axisLine: {show: false},
        //             axisTick: {show: false},
        //             axisLabel: {
        //               textStyle: {
        //                 color: color2
        //               }
        //             }
        //           }],
        //           yAxis: [
        //             {
        //               title: {
        //                 text: '',
        //                 style: {
        //                   color: color2
        //                 }
        //               },
        //               axisTick: {show: false},
        //               axisLabel: {
        //                 textStyle: {
        //                   color: color2
        //                 },
        //               },
        //               scale: true,
        //               splitLine,
        //               axisLine: {
        //                 lineStyle: {
        //                   color: color2
        //                 }
        //               },
        //             }],
        //           legend: {
        //             pageTextStyle,
        //             icon: 'circle',
        //             bottom: 40,
        //             type: 'scroll',
        //             itemWidth: 10,
        //             itemHeight: 10,
        //             textStyle: {color: color2, fontSize: '12', lineHeight: '12'}
        //           },
        //           dataZoom: [
        //             {
        //               type: 'inside',
        //               start: 80,
        //               end: 100
        //             },
        //             {
        //               show: true,
        //               type: 'slider',
        //               top: '90%',
        //               start: 80,
        //               end: 100
        //             }
        //           ],
        //           series: [
        //             {
        //               name: '日K',
        //               type: 'candlestick',
        //               data:arr[index].data.map(i => [i.subscription_openprice, i.subscription_price, i.subscription_lowprice, i.subscription_highprice]),
        //               itemStyle: {
        //                 color: upColor,
        //                 color0: downColor,
        //                 borderColor: upBorderColor,
        //                 borderColor0: downBorderColor
        //               },
        //             },
        //             {
        //               name: 'MA5',
        //               type: 'line',
        //               data: arr[index].data.map(i => i.subscription_MA5),
        //               smooth: true,
        //               symbol: 'none',
        //               lineStyle: {
        //                 opacity: 0.5
        //               }
        //             },
        //             {
        //               name: 'MA10',
        //               type: 'line',
        //               data: arr[index].data.map(i => i.subscription_MA10),
        //               smooth: true,
        //               symbol: 'none',
        //               lineStyle: {
        //                 opacity: 0.5
        //               }
        //             },
        //             {
        //               name: 'MA30',
        //               type: 'line',
        //               data: arr[index].data.map(i => i.subscription_MA30),
        //               smooth: true,
        //               symbol: 'none',
        //               lineStyle: {
        //                 opacity: 0.5
        //               }
        //             },
        //             {
        //               name: 'MA60',
        //               type: 'line',
        //               data: arr[index].data.map(i => i.subscription_MA60),
        //               smooth: true,
        //               symbol: 'none',
        //               lineStyle: {
        //                 opacity: 0.5
        //               }
        //             }

        //           ]
        //         }
        //         myChart[`myChart${index}`].setOption(option)
        //       }, 100)
        //     }

        //     if (arr[index].secondType === 'table') {
        //       content += '<table class="industry-data-table"><tbody class="tbody">'
        //       for (let ind = 0; ind < arr[index].data.length; ind++) {
        //         let item = arr[index].data[ind]
        //         if (item.ratioChange === '新进') {
        //           content += `<tr class="industry-data-first fs12">
        //                     <td class="industry-first-td line1 ta-left">${item.name}</td>
        //                     <td class="industry-data-pj ta-center">${item.HoldSum}</td>
        //                     <td class="industry-data-pj ta-right">${item.PCTOfTotalShares}</td>
        //                     <td class="industry-data-pj ta-right ratios">${item.ratioChange}</td>
        //                 </tr>`
        //         } else {
        //           content += `<tr class="industry-data-first fs12">
        //                     <td class="industry-first-td line1 ta-left">${item.name}</td>
        //                     <td class="industry-data-pj ta-center">${item.HoldSum}</td>
        //                     <td class="industry-data-pj ta-right">${item.PCTOfTotalShares}</td>
        //                     <td class="industry-data-pj ta-right">${item.ratioChange}</td>
        //                 </tr>`
        //         }
        //       }
        //       content += `</tbody></table>`
        //     }
        //   }
        // }

        for (let index = 0; index < arr.length; index++) {
          // 展示文字
          if((arr[index].type === 'paragraph' && arr[index].content) || (arr[index].type === 'algo-result' && arr[index].secondType === 'paragraph')) {
            content += `
            <div style="word-break: normal">${arr[index].content}</div>
            `
          }

          // 展示图片
          if(arr[index].type === 'paragraph' && arr[index].secondType === 'image' && arr[index].media_url) {
            content += `
            <div>
              <img src=${arr[index].media_url} alt="">
            </div>
            `
          }
          // 展示图片
          if(arr[index].type === 'paragraph' && arr[index].secondType === 'image' && arr[index].data) {
            content += `
            <div>
              <img src=${arr[index].data} alt="">
            </div>
            `
          }
          // 展示图片
          if(arr[index].type === 'algo-result' && arr[index].url) {
            content += `
            <div>
              <img src=${arr[index].url} alt="">
            </div>
            `
          }

          // 渲染单独的图表
          if (arr[index].type === 'chart') {
            let myChart = {}
            // 堆叠折线图 堆叠柱状图
            if (arr[index].secondType === 'stack' || arr[index].secondType === 'barStack') {
              let obj = arr[index].data[0]
              let rightArr = [] // 记录右轴 出现多数据取最大值
              let leftArr = [] // 记录左轴 出现多数据取最大值
              let rightMax1
              let rightMin1
              let leftMax1
              let leftMin1
              obj.series.map(i => {
                if (i.name.indexOf('右轴') !== -1) {
                  i.yAxisIndex = 1
                  rightArr = rightArr.concat(i.data)
                  let data11 = rightArr.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  const max1 = data11.reduce(function (total, value) {
                    return total + value
                  }, 0) / obj.series.length
                  // 右轴的最大值
                  rightMax1 = Math.max(1,max1) || 1
                  rightMin1 = Math.min(0,...data11) || 0
                } else {
                  leftArr = leftArr.concat(i.data)
                  let data22 = leftArr.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  const max2 = data22.reduce(function (total, value) {
                    return total + value
                  }, 0) / obj.series.length
                  // 左轴的最大值
                  leftMax1 = Math.max(1,max2) || 1
                  leftMin1 = Math.min(0,...data22) || 0
                  i.yAxisIndex = 0
                }
                i.stack = arr[index].secondType
                if (!i.type) {
                  i.type = arr[index].secondType === 'barStack' ? 'bar' : 'line'
                }
                i.symbol = 'none'
                i.areaStyle = {}
                return i
              })
              content += `
                <div class="chart" id="charts-${index}">
                  <div id="chart${index}" class="charts"></div>
                </div>
                `
              const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
              let y1Max1
              let y1Min1
              let y2Max1
              let y2Min1

              if (leftMax1 < rightMax1 * radio1) {
                y1Max1 = rightMax1 * radio1
                y2Max1 = rightMax1
              } else {
                y1Max1 = leftMax1
                y2Max1 = leftMax1 / radio1
              }
              if (leftMin1 < rightMin1 * radio1) {
                y1Min1 = leftMin1
                y2Min1 = leftMin1 / radio1
              } else {
                y1Min1 = rightMin1 * radio1
                y2Min1 = rightMin1
              }
              if (y1Min1 < 0 || y1Max1 < 0 || y2Max1 < 0 || y2Min1 < 0) {
                y1Max1 = -Math.ceil(-y1Max1)
                y1Min1 = -Math.ceil(-y1Min1)
                y2Max1 = -Math.ceil(-y2Max1)
                y2Min1 = -Math.ceil(-y2Min1)
              } else {
                y1Max1 = Math.ceil(y1Max1)
                y1Min1 = Math.ceil(y1Min1)
                y2Max1 = Math.ceil(y2Max1)
                y2Min1 = Math.ceil(y2Min1)
              }
              setTimeout(() => {
                let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                $(`#charts-${index}`).append(asd)
                myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
                $(`#charts-${index}`).before(`<div class="title">${obj.title}</div>`)
                let option = {
                  color: obj.series.length >= 4 ? color1 : color,
                  tooltip: {
                    trigger: 'axis',
                    confine: true,
                  },
                  grid: grid,
                  xAxis: [{
                    data: obj.x,
                    axisLabel:axisLabelx,
                    boundaryGap: arr[index].secondType !== 'stack'
                  }],
                  yAxis: [
                    {
                      splitLine:splitLine,
                      title: {
                        text: '',
                        style: {
                          color: 'rgba(34,34,34,0.45)'
                        }
                      },
                      axisLabel: axisLabel,
                      scale: true,
                      axisLine: {show: false},
                      axisTick: {show: false},
                    },{
                      title: {
                        text: '',
                        style: {
                          color: color2
                        }
                      },
                      axisLabel: {
                        ...axisLabel,
                        textStyle: {
                          color: color2
                        },
                      },
                      scale: true,
                      splitLine: {show: false},
                      axisTick,
                      axisLine: {
                        show: false,
                        lineStyle: {
                          color: color2
                        }
                      },
                    }],
                  legend: legend,
                  series: obj.series
                }
                myChart[`myChart${index}`].setOption(option, true)
              }, 1000)
            }

            if (arr[index].secondType === 'barLine') {
              let obj = arr[index].data[0]
              let rightArr = [] // 记录右轴 出现多数据取最大值
              let leftArr1 = [] // 记录左轴 出现多数据取最大值
              let leftArr2 = [] // 记录左轴 出现多数据取最大值
              let rightMax1
              let rightMin1
              let leftMax1
              let leftMin1
              obj.series.map(i => {
                if (i.name.indexOf('右轴') !== -1) {
                  i.yAxisIndex = 1
                  rightArr = rightArr.concat(i.data)
                  let data11 = rightArr.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  i.type = 'line'
                  // 右轴的最大值
                  rightMax1 = Math.max(1,...data11) || 1
                  rightMin1 = Math.min(0,...data11) || 0
                  i.yAxisIndex = 1
                } else {
                  leftArr1.push(Math.max(...i.data))
                  leftArr2 = leftArr2.concat(i.data)
                  let data22 = leftArr2.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  const max = leftArr1.reduce(function (total, value) {
                    return total + value
                  }, 0)
                  i.type = 'bar'
                  i.stack = arr[index].secondType
                  // 左轴的最大值
                  leftMax1 = Math.max(1,max) || 1
                  leftMin1 = Math.min(0,...data22) || 0
                  i.yAxisIndex = 0
                  console.log(max, 'max')
                }
                i.symbol = 'none'
                return i
              })
              content += `
                <div class="chart" id="charts-${index}">
                  <div id="chart${index}" class="charts"></div>
                </div>
                `
              const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
              let y1Max1
              let y1Min1
              let y2Max1
              let y2Min1

              if (leftMax1 < rightMax1 * radio1) {
                y1Max1 = rightMax1 * radio1
                y2Max1 = rightMax1
              } else {
                y1Max1 = leftMax1
                y2Max1 = leftMax1 / radio1
              }
              if (leftMin1 < rightMin1 * radio1) {
                y1Min1 = leftMin1
                y2Min1 = leftMin1 / radio1
              } else {
                y1Min1 = rightMin1 * radio1
                y2Min1 = rightMin1
              }
              if (y1Min1 < 0) {y1Min1 = -Math.ceil(-y1Min1)}
              if (y1Max1 < 0) {y1Max1 = -Math.ceil(-y1Max1)}
              if (y2Max1 < 0) {y2Max1 = -Math.ceil(-y2Max1)}
              if (y2Min1 < 0) {y2Min1 = -Math.ceil(-y2Min1)}
              y1Max1 = Math.ceil(y1Max1)
              y1Min1 = Math.ceil(y1Min1)
              y2Max1 = Math.ceil(y2Max1)
              y2Min1 = Math.ceil(y2Min1)
              // if (y1Min1 < 0 || y1Max1 < 0 || y2Max1 < 0 || y2Min1 < 0) {
              //   y1Max1 = -Math.ceil(-y1Max1)
              //   y1Min1 = -Math.ceil(-y1Min1)
              //   y2Max1 = -Math.ceil(-y2Max1)
              //   y2Min1 = -Math.ceil(-y2Min1)
              // } else {
              //   y1Max1 = Math.ceil(y1Max1 * 1.2)
              //   y1Min1 = Math.ceil(y1Min1)
              //   y2Max1 = Math.ceil(y2Max1 * 1.2)
              //   y2Min1 = Math.ceil(y2Min1)
              // }
              // console.log(y1Max1 * 1.2 , '00001')
              setTimeout(() => {
                let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                $(`#charts-${index}`).append(asd)
                myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
                $(`#charts-${index}`).before(`<div class="title">${obj.title}</div>`)
                let option = {
                  color: obj.series.length >= 4 ? color1 : color,
                  tooltip: {
                    trigger: 'axis',
                    confine: true,
                  },
                  grid: grid,
                  xAxis: [{
                    data: obj.x,
                    axisLabel:axisLabelx,
                    boundaryGap: arr[index].secondType !== 'stack'
                  }],
                  yAxis: [
                    {
                      max: y1Max1  || (y1Max1 === 0  ? (y1Max1 * 1.2) : null),
                      min: y1Min1 || (y1Min1 === 0 ? (y1Min1 * 1.2) : null),
                      title: {
                        text: '',
                        style: {
                          color: 'rgba(34,34,34,0.45)'
                        }
                      },
                      splitLine:splitLine,
                      splitNumber: 5,
                      minInterval: 1,
                      // interval: ((y1Max1*1.2 || y1Max1 === 0  ? (y1Max1 * 1.2).toFixed(0) : null || leftMax1) - (y1Min1*1.2  || y1Min1 === 0 ? (y1Min1 * 1.2).toFixed(0) : null || leftMin1))/5,
                      axisLabel: axisLabel,
                      scale: true,
                      axisLine: {show: false},
                      axisTick: {show: false},
                    },{
                      max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null),
                      min: y2Min1  || ( y2Min1 === 0 ? (y2Min1 * 1.2) : null),
                      title: {
                        text: '',
                        style: {
                          color: color2
                        }
                      },
                      splitNumber: 5,
                      minInterval: 1,
                      // interval:((y2Max1 || y2Max1 === 0  ? (y2Max1 * 1.2).toFixed(0) : null) - (y2Min1  || y2Min1 === 0 ? (y2Min1 * 1.2).toFixed(0) : null))/5,
                      axisLabel: {
                        ...axisLabel,
                        textStyle: {
                          color: color2
                        },
                      },
                      scale: true,
                      splitLine: {show: false},
                      axisTick,
                      axisLine: {
                        show: false,
                        lineStyle: {
                          color: color2
                        }
                      },
                    }],
                  legend: legend,
                  series: obj.series
                }
                myChart[`myChart${index}`].setOption(option, true)
              }, 1000)
            }


            if (arr[index].secondType === 'line') {
              let rightArr = [] // 记录右轴 出现多数据取最大值
              let  leftArr = [] // 记录左轴 出现多数据取最大值
              let rightMax1
              let rightMin1
              let leftMax1
              let leftMin1
              let obj = arr[index].data[0]
              obj.series.map(i => {
                if (i.name.indexOf('右轴') !== -1) {
                  i.yAxisIndex = 1
                  rightArr = rightArr.concat(i.data)
                  let data11 = rightArr.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  // 右轴的最大值
                  rightMax1 = Math.max(1,...data11) || 1
                  rightMin1 = Math.min(0,...data11) || 0
                } else {
                  leftArr = leftArr.concat(i.data)
                  let data22 = leftArr.map(it => {
                    if (it === 'undefined') {it = '0.00'}
                    return Number(it)
                  })
                  // 左轴的最大值
                  leftMax1 = Math.max(1,...data22) || 1
                  leftMin1 = Math.min(0,...data22) || 0
                  i.yAxisIndex = 0
                }
                i.type = 'line'
                i.symbol = 'none'
                return i
              })
              content += `
                <div class="chart" id="charts-${index}">
                  <div id="chart${index}" class="charts"></div>
                </div>
                `
              const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
              let y1Max1
              let y1Min1
              let y2Max1
              let y2Min1

              if (leftMax1 < rightMax1 * radio1) {
                y1Max1 = rightMax1 * radio1
                y2Max1 = rightMax1
              } else {
                y1Max1 = leftMax1
                y2Max1 = leftMax1 / radio1
              }
              if (leftMin1 < rightMin1 * radio1) {
                y1Min1 = leftMin1
                y2Min1 = leftMin1 / radio1
              } else {
                y1Min1 = rightMin1 * radio1
                y2Min1 = rightMin1
              }
              if (y1Min1 < 0) {y1Min1 = -Math.ceil(-y1Min1)}
              if (y1Max1 < 0) {y1Max1 = -Math.ceil(-y1Max1)}
              if (y2Max1 < 0) {y2Max1 = -Math.ceil(-y2Max1)}
              if (y2Min1 < 0) {y2Min1 = -Math.ceil(-y2Min1)}
              y1Max1 = Math.ceil(y1Max1)
              y1Min1 = Math.ceil(y1Min1)
              y2Max1 = Math.ceil(y2Max1)
              y2Min1 = Math.ceil(y2Min1)
              setTimeout(() => {
                let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                $(`#charts-${index}`).append(asd)
                myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
                $(`#charts-${index}`).before(`<div class="title">${obj.title}</div>`)
                let option = {
                  color: obj.series.length >= 4 ? color1 : color,
                  tooltip: {
                    trigger: 'axis',
                    confine: true,
                  },
                  grid: grid,
                  xAxis: [{
                    data: obj.x,
                    axisLabel:axisLabelx,
                    boundaryGap: arr[index].secondType !== 'stack'
                  }],
                  yAxis: [
                    {
                      splitLine:splitLine,
                      max: y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1,
                      min: y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1,
                      title: {
                        text: '',
                        style: {
                          color: 'rgba(34,34,34,0.45)'
                        }
                      },
                      splitNumber: 5,
                      minInterval: 1,
                      // interval: ((y1Max1 || y1Max1 === 0  ? (y1Max1 * 1.2).toFixed(0) : null || leftMax1) - (y1Min1  || y1Min1 === 0 ? (y1Min1 * 1.2).toFixed(0) : null || leftMin1))/5,
                      axisLabel: axisLabel,
                      scale: true,
                      axisLine: {show: false},
                      axisTick: {show: false},
                    },{
                      max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null),
                      min: y2Min1  || ( y2Min1 === 0 ? (y2Min1 * 1.2) : null),
                      title: {
                        text: '',
                        style: {
                          color: color2
                        }
                      },
                      splitNumber: 5,
                      minInterval: 1,
                      // interval:((y2Max1 || y2Max1 === 0  ? (y2Max1 * 1.2).toFixed(0) : null) - (y2Min1  || y2Min1 === 0 ? (y2Min1 * 1.2).toFixed(0) : null))/5,
                      axisLabel: {
                        ...axisLabel,
                        textStyle: {
                          color: color2
                        },
                      },
                      scale: true,
                      splitLine: {show: false},
                      axisTick,
                      axisLine: {
                        show: false,
                        lineStyle: {
                          color: color2
                        }
                      },
                    }],
                  legend: legend,
                  series: obj.series
                }
                myChart[`myChart${index}`].setOption(option, true)
              }, 1000)
            }

            // 当时多个折线 柱图表时
            if (arr[index].secondType === 'line-line-line-line' || arr[index].secondType === 'bar-line-bar-line' || arr[index].secondType === 'line-line') {
              const secondType = arr[index].secondType.split('-')
              for (let ind = 0; ind < secondType.length; ind++) {
                content += `
                <div class="chart" id="charts-${index}-${ind}">
                  <div id="chart${index}-${ind}" class="charts"></div>
                </div>
                `
                const data = arr[index].data[ind]
                let rightArr = [] // 记录右轴 出现多数据取最大值
                let leftArr = [] // 记录左轴 出现多数据取最大值
                let rightMax1
                let rightMin1
                let leftMax1
                let leftMin1
                data.series.map(i => {
                  if (i.name.indexOf('右轴') !== -1) {
                    i.yAxisIndex = 1
                    rightArr = rightArr.concat(i.data)
                    let data11 = rightArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 右轴的最大值
                    rightMax1 = Math.max(1,...data11) || 1
                    rightMin1 = Math.min(0,...data11) || 0
                  } else {
                    leftArr = leftArr.concat(i.data)
                    let data22 = leftArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 左轴的最大值
                    leftMax1 = Math.max(1,...data22) || 1
                    leftMin1 = Math.min(0,...data22) || 0
                    i.yAxisIndex = 0
                  }
                  i.type = secondType[ind]
                  i.symbol = 'none'
                  return i
                })
                const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1) || 2
                let y1Max1
                let y1Min1
                let y2Max1
                let y2Min1

                if (leftMax1 < rightMax1 * radio1) {
                  y1Max1 = rightMax1 * radio1
                  y2Max1 = rightMax1
                } else {
                  y1Max1 = leftMax1
                  y2Max1 = leftMax1 / radio1
                }
                if (leftMin1 < rightMin1 * radio1) {
                  y1Min1 = leftMin1
                  y2Min1 = leftMin1 / radio1
                } else {
                  y1Min1 = rightMin1 * radio1
                  y2Min1 = rightMin1
                }
                // 如果最小值是负数 则先处理成正数在进行取反
                if (y1Min1 < 0) {y1Min1 = -Math.ceil(-y1Min1)}
                if (y1Max1 < 0) {y1Max1 = -Math.ceil(-y1Max1)}
                if (y2Max1 < 0) {y2Max1 = -Math.ceil(-y2Max1)}
                if (y2Min1 < 0) {y2Min1 = -Math.ceil(-y2Min1)}
                y1Max1 = Math.ceil(y1Max1)
                y1Min1 = Math.ceil(y1Min1)
                y2Max1 = Math.ceil(y2Max1)
                y2Min1 = Math.ceil(y2Min1)
                setTimeout(() => {

                  let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                  $(`#charts-${index}-${ind}`).append(asd)
                  myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
                  $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
                  let option = {
                    color: data.series.length >= 4 ? color1 : color,
                    tooltip: {
                      trigger: 'axis',
                      confine: true,
                    },
                    grid: grid,
                    xAxis: [{
                      data: data.x,
                      axisLabel: axisLabelx
                    }],
                    yAxis: [
                      {
                        splitLine:splitLine,
                        max: y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1,
                        min: y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1,
                        splitNumber: 5,
                        // minInterval: 1,
                        // interval: ((y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1) - (y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1))/5,
                        title: {
                          text: '',
                          style: {
                            color: 'rgba(34,34,34,0.45)'
                          }
                        },
                        axisLabel: axisLabel,
                        scale: true,
                        axisLine: {show: false},axisTick: {show: false},
                      },{
                        max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1,
                        min: y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1,
                        title: {
                          text: '',
                          style: {
                            color: color2
                          }
                        },
                        splitNumber: 5,
                        minInterval: 1,
                        // interval:((y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1) - (y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1))/5,
                        axisTick: {
                          show: false,
                        },
                        axisLine: {
                          show: false,
                          lineStyle: {
                            color: color2
                          }
                        },
                        axisLabel: {
                          ...axisLabel,
                          textStyle: {
                            color: color2
                          },
                        },
                        scale: true,
                        splitLine: {show: false}
                      }],
                    legend: legend,
                    series: data.series
                  }
                  myChart[`myChart${index}`].setOption(option, true)
                }, 1000)
              }
            }
            // 当时柱图-折线表时
            if (arr[index].secondType === 'bar-line') {
              const secondType = arr[index].secondType.split('-')

              for (let ind = 0; ind < secondType.length; ind++) {
                content += `
                <div class="chart" id="charts-${index}-${ind}">
                  <div id="chart${index}-${ind}" class="charts"></div>
                </div>
                `
                const data = arr[index].data[ind]
                let rightArr = [] // 记录右轴 出现多数据取最大值
                let leftArr = [] // 记录左轴 出现多数据取最大值
                let rightMax1
                let rightMin1
                let leftMax1
                let leftMin1
                data.series.map(i => {
                  if (i.name.indexOf('右轴') !== -1) {
                    i.yAxisIndex = 1
                    rightArr = rightArr.concat(i.data)
                    let data11 = rightArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 右轴的最大值
                    rightMax1 = Math.max(1,...data11) || 1
                    rightMin1 = Math.min(0,...data11) || 0
                  } else {
                    leftArr = leftArr.concat(i.data)
                    let data22 = leftArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 左轴的最大值
                    leftMax1 = Math.max(1,...data22) || 1
                    leftMin1 = Math.min(0,...data22) || 0
                    i.yAxisIndex = 0
                  }
                  i.type = secondType[ind]
                  i.symbol = 'none'
                  return i
                })
                const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1) || 2
                let y1Max1
                let y1Min1
                let y2Max1
                let y2Min1

                if (leftMax1 < rightMax1 * radio1) {
                  y1Max1 = rightMax1 * radio1
                  y2Max1 = rightMax1
                } else {
                  y1Max1 = leftMax1
                  y2Max1 = leftMax1 / radio1
                }
                if (leftMin1 < rightMin1 * radio1) {
                  y1Min1 = leftMin1
                  y2Min1 = leftMin1 / radio1
                } else {
                  y1Min1 = rightMin1 * radio1
                  y2Min1 = rightMin1
                }
                if (y1Min1 < 0) {y1Min1 = -Math.ceil(-y1Min1)}
                if (y1Max1 < 0) {y1Max1 = -Math.ceil(-y1Max1)}
                if (y2Max1 < 0) {y2Max1 = -Math.ceil(-y2Max1)}
                if (y2Min1 < 0) {y2Min1 = -Math.ceil(-y2Min1)}
                y1Max1 = Math.ceil(y1Max1)
                y1Min1 = Math.ceil(y1Min1)
                y2Max1 = Math.ceil(y2Max1)
                y2Min1 = Math.ceil(y2Min1)
                setTimeout(() => {

                  let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                  $(`#charts-${index}-${ind}`).append(asd)
                  myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
                  $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
                  let option = {
                    color: data.series.length >= 4 ? color1 : color,
                    tooltip: {
                      trigger: 'axis',
                      confine: true,
                    },
                    grid: grid,
                    xAxis: [{
                      data: data.x,
                      axisLabel: axisLabelx
                    }],
                    yAxis: [
                      {
                        splitLine:splitLine,
                        max: y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1,
                        min: y1Min1 || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1,
                        splitNumber: 5,
                        minInterval: 1,
                        // interval: ((y1Max1*1.2 || y1Max1 === 0  ? (y1Max1 * 1.2).toFixed(0) : null || leftMax1) - (y1Min1  || y1Min1 === 0 ? (y1Min1 * 1.2).toFixed(0) : null || leftMin1))/5,

                        title: {
                          text: '',
                          style: {
                            color: 'rgba(34,34,34,0.45)'
                          }
                        },
                        axisLabel: axisLabel,
                        scale: true,
                        axisLine: {show: false},axisTick: {show: false},
                      },{
                        max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1,
                        min: y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1,
                        splitNumber: 5,
                        minInterval: 1,
                        // interval:((y2Max1 || y2Max1 === 0  ? (y2Max1 * 1.2).toFixed(0) : null || rightMax1) - (y2Min1  || y2Min1 === 0 ? (y2Min1 * 1.2).toFixed(0) : null || rightMin1))/5,

                        title: {
                          text: '',
                          style: {
                            color: color2
                          }
                        },
                        axisTick: {
                          show: false,
                        },
                        axisLine: {
                          show: false,
                          lineStyle: {
                            color: color2
                          }
                        },
                        axisLabel: {
                          ...axisLabel,
                          textStyle: {
                            color: color2
                          },
                        },
                        scale: true,
                        splitLine: {show: false}
                      }],
                    legend: legend,
                    series: data.series
                  }
                  myChart[`myChart${index}`].setOption(option, true)
                }, 1000)
              }
            }
            //  当全是饼图时的
            if (arr[index].secondType === 'pie-pie') {

              const secondType = arr[index].secondType.split('-')
              if (secondType.length === arr[index].data.length) {
                for (let ind = 0; ind < secondType.length; ind++) {
                  content += `
                <div class="chart" id="charts-${index}-${ind}">
                  <div id="chart${index}-${ind}" class="charts"></div>
                </div>
                `
                  setTimeout(() => {
                    const data = arr[index].data[ind]
                    let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                    $(`#charts-${index}-${ind}`).append(asd)
                    myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
                    $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
                    let option = {
                      color: data.series.length >= 4 ? color1 : color,
                      tooltip: {
                        trigger: 'item',
                        confine: true,
                      },
                      grid: grid,

                      legend: {
                        icon: 'roundRect',
                        ...legend,
                      },
                      series: {
                        data: data.series.map(i => {
                          return {
                            name: i.name,
                            value: i.value || i.ratio
                          }
                        }),
                        type: 'pie',
                        radius: ['40%', '60%'],
                        label: {
                          formatter: '{b}\n{c}'
                        }
                      }
                    }
                    myChart[`myChart${index}`].setOption(option, true)
                  }, 1000)
                }

              } else if (arr[index].data.length === 1){
                content += `
                <div class="chart" id="charts-${index}">
                  <div id="chart${index}" class="charts"></div>
                </div>
                `
                setTimeout(() => {
                  const data = arr[index].data[0]
                  let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                  $(`#charts-${index}`).append(asd)
                  myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
                  $(`#charts-${index}`).before(`<div class="title">${data.title}</div>`)
                  let option = {
                    color: data.series.length >= 4 ? color1 : color,
                    tooltip: {
                      trigger: 'item',
                      confine: true,
                    },
                    grid: grid,

                    legend: {
                      icon: 'roundRect',
                      ...legend,
                    },
                    series: {
                      data: data.series.map(i => {
                        if (i.ratio) {
                          i.value = i.ratio
                        }
                        return i
                      }),
                      type: 'pie',
                      radius: ['40%', '60%'],
                      label: {
                        formatter: '{b}\n{c}'
                      }
                    }
                  }
                  myChart[`myChart${index}`].setOption(option, true)
                }, 1000)
              }
              // for (let ind = 0; ind <secondType.length; ind++) {
              //   content += `
              //   <div class="chart" id="charts-${index}-${ind}">
              //     <div id="chart${index}-${ind}" class="charts"></div>
              //   </div>
              //   `
              //   setTimeout(() => {
              //     const data = arr[index].data[ind]
              //     let asd =  `<div class="footers">${arr[index].dataSource}</div>`
              //     $(`#charts-${index}-${ind}`).append(asd)
              //     myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
              //     $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
              //     let option = {
              //       color: data.series.length >= 4 ? color1 : color,
              //       tooltip: {
              //         trigger: 'item',
              //         confine: true,
              //       },
              //       grid: grid,

              //      legend: {
              //         icon: 'roundRect',
              //        ...legend,
              //       },
              //       series: {
              //         data: data.series,
              //         type: 'pie',
              //         radius: ['40%', '60%'],
              //         label: {
              //           formatter: '{b}\n{c}'
              //         }
              //       }
              //     }
              //     myChart[`myChart${index}`].setOption(option, true)
              //   }, 1000)

              // }

            }

            // 当时堆叠及饼图
            if (arr[index].secondType === 'stack-pie' || arr[index].secondType === 'stack-barGroupLine') {
              const secondType = arr[index].secondType.split('-')
              for (let ind = 0; ind < secondType.length; ind++) {
                content += `
                <div class="chart" id="charts-${index}-${ind}">
                  <div id="chart${index}-${ind}" class="charts"></div>
                </div>
                `

                setTimeout(() => {
                  const data = arr[index].data[ind]
                  let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                  $(`#charts-${index}-${ind}`).append(asd)
                  myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
                  $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
                  if (secondType[ind] === 'stack') {
                    // let rightArr = [] // 记录右轴 出现多数据取最大值
                    let leftArr = [] // 记录左轴 出现多数据取最大值
                    // let rightMax1
                    // let rightMin1
                    let leftMax1
                    let leftMin1

                    data.series.map(i => {
                      leftArr = leftArr.concat(i.data)
                      let data22 = leftArr.map(it => {
                        if (it === 'undefined') {it = '0.00'}
                        return Number(it)
                      })
                      const max2 = data22.reduce(function (total, value) {
                        return total + value
                      }, 0) / 4
                      // 左轴的最大值
                      leftMax1 = Math.max(1,max2) || 1
                      leftMin1 = Math.min(0,...data22) || 0
                      i.stack = secondType[ind]
                      i.symbol = 'none'
                      i.areaStyle = {}
                      return i
                    })
                    if (leftMax1 < 0 || leftMin1 < 0) {
                      leftMax1 = -Math.ceil(-leftMax1)
                      leftMin1 = -Math.ceil(-leftMin1)
                    } else {
                      leftMax1 = Math.ceil(leftMax1)
                      leftMin1 = Math.ceil(leftMin1)
                    }
                    let option = {
                      color: data.series.length >= 4 ? color1 : color,
                      tooltip: {
                        trigger: 'axis',
                        confine: true,
                      },
                      grid: grid,
                      xAxis: [{
                        data: data.x,
                        axisLabel: axisLabelx,
                        boundaryGap: secondType[ind] !== 'stack'
                      }],
                      yAxis: [
                        {
                          splitLine:splitLine,
                          max:  leftMax1,
                          min: leftMin1,
                          splitNumber: 5,
                          minInterval: 1,
                          // interval: (leftMax1 - leftMin1)/5,

                          title: {
                            text: '',
                            style: {
                              color: 'rgba(34,34,34,0.45)'
                            }
                          },
                          axisLabel: axisLabel,
                          scale: true,
                          axisLine: {show: false},axisTick: {show: false},
                        },{
                          title: {
                            text: '',
                            style: {
                              color: color2
                            }
                          },
                          axisTick: {
                            show: false,
                          },
                          axisLine: {
                            show: false,
                            lineStyle: {
                              color: color2
                            }
                          },
                          axisLabel: {
                            textStyle: {
                              color: color2
                            },
                          },
                          scale: true,
                          splitLine: {show: false}
                        }],
                      legend: legend,
                      series: data.series
                    }
                    myChart[`myChart${index}`].setOption(option, true)
                  } else if (secondType[ind] === 'pie') {
                    let option = {
                      color: data.series.length >= 4 ? color1 : color,
                      tooltip: {
                        trigger: 'item',
                        confine: true,
                      },
                      grid: grid,

                      legend: {
                        icon: 'roundRect',
                        ...legend,
                      },
                      series: {
                        data: data.series,
                        type: 'pie',
                        radius: ['40%', '60%'],
                        label: {
                          formatter: '{b}\n{c}'
                        }
                      }
                    }
                    myChart[`myChart${index}`].setOption(option, true)
                  } else if (secondType[ind] === 'barGroupLine') {
                    let rightArr = [] // 记录右轴 出现多数据取最大值
                    let leftArr = [] // 记录左轴 出现多数据取最大值
                    let rightMax1
                    let rightMin1
                    let leftMax1
                    let leftMin1
                    data.series.map(i => {
                      if (i.name.indexOf('右轴') !== -1) {
                        i.yAxisIndex = 1
                        rightArr = rightArr.concat(i.data)
                        let data11 = rightArr.map(it => {
                          if (it === 'undefined') {it = '0.00'}
                          return Number(it)
                        })
                        // 右轴的最大值
                        rightMax1 = Math.max(1,...data11) || 1
                        rightMin1 = Math.min(0,...data11) || 0
                      } else {
                        leftArr = leftArr.concat(i.data)
                        let data22 = leftArr.map(it => {
                          if (it === 'undefined') {it = '0.00'}
                          return Number(it)
                        })
                        // 左轴的最大值
                        leftMax1 = Math.max(1,...data22) || 1
                        leftMin1 = Math.min(0,...data22) || 0
                        i.yAxisIndex = 0
                      }
                      return i
                    })
                    const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
                    let y1Max1
                    let y1Min1
                    let y2Max1
                    let y2Min1

                    if (leftMax1 < rightMax1 * radio1) {
                      y1Max1 = rightMax1 * radio1
                      y2Max1 = rightMax1
                    } else {
                      y1Max1 = leftMax1
                      y2Max1 = leftMax1 / radio1
                    }
                    if (leftMin1 < rightMin1 * radio1) {
                      y1Min1 = leftMin1
                      y2Min1 = leftMin1 / radio1
                    } else {
                      y1Min1 = rightMin1 * radio1
                      y2Min1 = rightMin1
                    }
                    // 如果最小值是负数 则先处理成正数在进行取反
                    if (y1Min1 < 0 || y1Max1 < 0 || y2Max1 < 0 || y2Min1 < 0) {
                      y1Max1 = -Math.ceil(-y1Max1)
                      y1Min1 = -Math.ceil(-y1Min1)
                      y2Max1 = -Math.ceil(-y2Max1)
                      y2Min1 = -Math.ceil(-y2Min1)
                    } else {
                      y1Max1 = Math.ceil(y1Max1)
                      y1Min1 = Math.ceil(y1Min1)
                      y2Max1 = Math.ceil(y2Max1)
                      y2Min1 = Math.ceil(y2Min1)
                    }

                    let option = {
                      color: data.series.length >= 4 ? color1 : color,
                      tooltip: {
                        trigger: 'axis',
                        confine: true,
                      },
                      grid: grid,
                      xAxis: [{
                        data: data.x,
                        axisLabel: axisLabelx,
                      }],
                      yAxis: [
                        {
                          splitLine:splitLine,
                          max: y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1,
                          min: y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1,
                          splitNumber: 5,
                          minInterval: 1,
                          interval: ((y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1) - (y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1)) / 5,

                          title: {
                            text: '',
                            style: {
                              color: 'rgba(34,34,34,0.45)'
                            }
                          },
                          axisLabel: axisLabel,
                          scale: true,
                          axisLine: {show: false},axisTick: {show: false},
                        },{
                          max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1,
                          min: y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1,
                          splitNumber: 5,
                          minInterval: 1,
                          interval:((y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1) - (y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1)) / 5,

                          title: {
                            text: '',
                            style: {
                              color: color2
                            }
                          },
                          axisTick: {
                            show: false,
                          },
                          axisLine: {
                            show: false,
                            lineStyle: {
                              color: color2
                            }
                          },
                          axisLabel: {
                            textStyle: {
                              color: color2
                            },
                          },
                          scale: true,
                          splitLine: {show: false}
                        }],
                      legend: legend,
                      series: data.series
                    }
                    myChart[`myChart${index}`].setOption(option, true)

                  }

                }, 1000)
              }
            }

            if (arr[index].secondType === 'barGroupLine-barGroupLine') {
              const secondType = arr[index].secondType.split('-')

              for (let ind = 0; ind < secondType.length; ind++) {
                content += `
                <div class="chart" id="charts-${index}-${ind}">
                  <div id="chart${index}-${ind}" class="charts"></div>
                </div>
                `

                const data = arr[index].data[ind]
                let rightArr = [] // 记录右轴 出现多数据取最大值
                let leftArr = [] // 记录左轴 出现多数据取最大值
                let rightMax1
                let rightMin1
                let leftMax1
                let leftMin1
                data.series.map(i => {
                  if (i.name.indexOf('右轴') !== -1) {
                    i.yAxisIndex = 1
                    rightArr = rightArr.concat(i.data)
                    let data11 = rightArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 右轴的最大值
                    rightMax1 = Math.max(1,...data11) || 1
                    rightMin1 = Math.min(0,...data11) || 0
                  } else {
                    leftArr = leftArr.concat(i.data)
                    let data22 = leftArr.map(it => {
                      if (it === 'undefined') {it = '0.00'}
                      return Number(it)
                    })
                    // 左轴的最大值
                    leftMax1 = Math.max(1,...data22) || 1
                    leftMin1 = Math.min(0,...data22) || 0
                    i.yAxisIndex = 0
                  }
                  return i
                })

                const radio1 = (leftMax1 - leftMin1) / (rightMax1 - rightMin1)
                let y1Max1
                let y1Min1
                let y2Max1
                let y2Min1

                if (leftMax1 < rightMax1 * radio1) {
                  y1Max1 = rightMax1 * radio1
                  y2Max1 = rightMax1
                } else {
                  y1Max1 = leftMax1
                  y2Max1 = leftMax1 / radio1
                }
                if (leftMin1 < rightMin1 * radio1) {
                  y1Min1 = leftMin1
                  y2Min1 = leftMin1 / radio1
                } else {
                  y1Min1 = rightMin1 * radio1
                  y2Min1 = rightMin1
                }
                // 如果最小值是负数 则先处理成正数在进行取反
                if (y1Min1 < 0) {y1Min1 = -Math.ceil(-y1Min1)}
                if (y1Max1 < 0) {y1Max1 = -Math.ceil(-y1Max1)}
                if (y2Max1 < 0) {y2Max1 = -Math.ceil(-y2Max1)}
                if (y2Min1 < 0) {y2Min1 = -Math.ceil(-y2Min1)}
                y1Max1 = Math.ceil(y1Max1)
                y1Min1 = Math.ceil(y1Min1)
                y2Max1 = Math.ceil(y2Max1)
                y2Min1 = Math.ceil(y2Min1)

                setTimeout(() => {

                  let asd =  `<div class="footers">${arr[index].dataSource}</div>`
                  $(`#charts-${index}-${ind}`).append(asd)
                  myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}-${ind}`))
                  $(`#charts-${index}-${ind}`).before(`<div class="title">${data.title}</div>`)
                  if (secondType[ind] === 'barGroupLine') {
                    let option = {
                      color: data.series.length >= 4 ? color1 : color,
                      tooltip: {
                        trigger: 'axis',
                        confine: true,
                      },
                      grid: grid,
                      xAxis: [{
                        data: data.x,
                        axisLabel: axisLabelx,
                      }],
                      yAxis: [
                        {
                          splitLine:splitLine,
                          max: y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1,
                          min: y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1,
                          splitNumber: 5,
                          minInterval: 1,
                          interval: ((y1Max1 || (y1Max1 === 0  ? (y1Max1 * 1.2) : null) || leftMax1) - (y1Min1  || (y1Min1 === 0 ? (y1Min1 * 1.2) : null) || leftMin1)) / 5,
                          title: {
                            text: '',
                            style: {
                              color: 'rgba(34,34,34,0.45)'
                            }
                          },
                          axisLabel: axisLabel,
                          scale: true,
                          axisLine: {show: false},axisTick: {show: false},
                        },{
                          max: y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1,
                          min: y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1,
                          splitNumber: 5,
                          minInterval: 1,
                          interval:((y2Max1 || (y2Max1 === 0  ? (y2Max1 * 1.2) : null) || rightMax1) - (y2Min1  || (y2Min1 === 0 ? (y2Min1 * 1.2) : null) || rightMin1)) / 5,
                          title: {
                            text: '',
                            style: {
                              color: color2
                            }
                          },
                          axisTick: {
                            show: false,
                          },
                          axisLine: {
                            show: false,
                            lineStyle: {
                              color: color2
                            }
                          },
                          axisLabel: {
                            ...axisLabel,
                            textStyle: {
                              color: color2
                            },
                          },
                          scale: true,
                          splitLine: {show: false}
                        }],
                      legend: legend,
                      series: data.series
                    }
                    myChart[`myChart${index}`].setOption(option, true)

                  }

                }, 1000)
              }
            }

            if (arr[index].secondType === 'kLine') {
              const upColor = '#ec0000'
              const upBorderColor = '#8A0000'
              const downColor = '#00da3c'
              const downBorderColor = '#008F28'
              content += `
                <div class="chart" id="charts-${index}">
                  <div class="title">${arr[index].secuabbr}${arr[index].code} | 日K</div>
                  <div id="chart${index}" class="charts"></div>
                  <div class="footers">数据来源：恒生聚源</div>
                </div>
                `
              setTimeout(() => {
                myChart[`myChart${index}`] = echarts.init(document.getElementById(`chart${index}`))
                let option = {
                  color: ['#faa198', '#85a5ff', '#ffc53d', '#a8e0fb', '#777bf6', '#e8b9d8', '#86d6d9', '#ffda9c', '#8dadda'],
                  tooltip: {
                    show: false,
                    // trigger: 'axis',
                    // confine: true,
                  },
                  grid: {
                    top: '2%',
                    left: '3%',
                    right: '4%',
                    containLabel: true,
                  },
                  xAxis: [{
                    data: arr[index].data.map(i => i.tradingday),
                    axisLine: {show: false},
                    axisTick: {show: false},
                    axisLabel: {
                      textStyle: {
                        color: color2
                      }
                    }
                  }],
                  yAxis: [
                    {
                      splitLine:splitLine,
                      title: {
                        text: '',
                        style: {
                          color: color2
                        }
                      },
                      axisLine: {show: false},
                      axisTick: {show: false},
                      axisLabel: {
                        textStyle: {
                          color: color2
                        },
                      },
                      scale: true
                    }],
                  legend: {
                    bottom: 40,
                    type: 'scroll',
                    itemWidth: 10,
                    itemHeight: 10,
                    textStyle: {color: color2, fontSize: '12', lineHeight: '12'},
                    selected: {
                      'MA5': false,
                      'MA10': false,
                      'MA30': false,
                      'MA60': false,
                    }
                  },
                  dataZoom: [
                    {
                      type: 'inside',
                      start: 80,
                      end: 100
                    },
                    {
                      show: true,
                      type: 'slider',
                      top: '90%',
                      start: 80,
                      end: 100,
                      borderColor: color2
                    }
                  ],
                  series: [
                    {
                      name: '日K',
                      type: 'candlestick',
                      data:arr[index].data.map(i => [i.subscription_openprice, i.subscription_price, i.subscription_lowprice, i.subscription_highprice]),
                      itemStyle: {
                        color: upColor,
                        color0: downColor,
                        borderColor: upBorderColor,
                        borderColor0: downBorderColor
                      },
                    },
                    {
                      name: 'MA5',
                      type: 'line',
                      data: arr[index].data.map(i => i.subscription_MA5),
                      smooth: true,
                      symbol: 'none',
                      lineStyle: {
                        opacity: 0.5
                      }
                    },
                    {
                      name: 'MA10',
                      type: 'line',
                      data: arr[index].data.map(i => i.subscription_MA10),
                      smooth: true,
                      symbol: 'none',
                      lineStyle: {
                        opacity: 0.5
                      }
                    },
                    {
                      name: 'MA30',
                      type: 'line',
                      data: arr[index].data.map(i => i.subscription_MA30),
                      smooth: true,
                      symbol: 'none',
                      lineStyle: {
                        opacity: 0.5
                      }
                    },
                    {
                      name: 'MA60',
                      type: 'line',
                      data: arr[index].data.map(i => i.subscription_MA60),
                      smooth: true,
                      symbol: 'none',
                      lineStyle: {
                        opacity: 0.5
                      }
                    }

                  ]
                }
                myChart[`myChart${index}`].setOption(option)
              }, 100)
            }

            if (arr[index].secondType === 'table') {
              content += '<table class="industry-data-table"><tbody class="tbody">'
              for (let ind = 0; ind < arr[index].data.length; ind++) {
                let item = arr[index].data[ind]
                if (item.ratioChange === '新进' || Number(item.ratioChange) > 0) {
                  content += `<tr class="industry-data-first fs12">
                            <td class="industry-first-td line1 ta-left">${item.name}</td>
                            <td class="industry-data-pj ta-center">${item.HoldSum}</td>
                            <td class="industry-data-pj ta-right">${item.PCTOfTotalShares}</td>
                            <td class="industry-data-pj ta-right ratios">${item.ratioChange}</td>
                        </tr>`
                } else {
                  content += `<tr class="industry-data-first fs12">
                            <td class="industry-first-td line1 ta-left">${item.name}</td>
                            <td class="industry-data-pj ta-center">${item.HoldSum}</td>
                            <td class="industry-data-pj ta-right">${item.PCTOfTotalShares}</td>
                            <td class="industry-data-pj ta-right">${item.ratioChange}</td>
                        </tr>`
                }
              }
              content += `</tbody></table>`
            }
          }
        }
        let partTwo =
        `
        <div class="info-detail-content-maintext1 info-detail" id='info-detail'>
          ${content}
          <div class="info-detail-blank1"></div>
          <div class="info-detail-user">
            核校：${data.createUser}
          </div>
        </div>


        <a href="javascript:goto('${data.appendixUrl}','-2','我是附件')" class="info-detail-fujian">
          声明：文中所有数据请以公告原文为准。详见附件
          <img src="../../images/details/pdf.jpg" alt="" >
        </a>
        <div class="info-detail-content-lastText hsyylwzlfont20">
          中证网声明：凡本网注明“来源：中国证券报·中证网”的所有作品，版权均属于中国证券报、中证网。中国证券报·中证网与作品作者联合声明，任何组织未经中国证券报、中证网以及作者书面授权不得转载、摘编或利用其它方式使用上述作品。
        </div>

        <div class="info-detail-describe">
          <div class=" flex-row align-items-start">
            <div class="info-auth-content"></div>
          </div>
        </div>

        <div class="info-detail-content-footer">
          <div class="info-detail-content-footer-praise">
            <div class="info-detail-content-footer-praise-box">
              <div class="box1">
                <img src="${configColorType === '1' ? '../../images/allPic/blackdianzan.png' : '../../images/allPic/nodianzan1.png'}" alt="" data-status='1' class="img1" style="display:${data.thumbsupStatus === '0' ? 'block' : 'none'}" onclick="zxupdatePriase1({'thumbupObjectId':'${data.infoId}','status':'${data.thumbsupStatus === '0' ? '1' : '0'}'},this)">
                <img src="../../images/allPic/yidianzan1.png" alt="" data-status='0' class="img1" style="display:${data.thumbsupStatus === '1' ? 'block' : 'none'}" onclick="zxupdatePriase1({'thumbupObjectId':'${data.infoId}','status':'${data.thumbsupStatus === '1' ? '0' : '1'}'},this)">
              </div>
              <div class="box2">${data.thumbsupCnt}</div>
            </div>
          </div>

          <div class="info-detail-content-footer-desc">
            好文章，需要你的鼓励
          </div>

          <div class="info-detail-content-footer-pic">
            <div class="pic2 pic">

            </div>
            <div class="pic1 pic">
              <img src="${configColorType === '1' ? '../../images/allPic/blackpyq.png' : '../../images/allPic/pengyouquan.png'}" alt="" onclick="sharepyq()">
            </div>
            <div class="pic2 pic">
              <img src="${configColorType === '1' ? '../../images/allPic/blackweixin.png' : '../../images/allPic/weixin@2x.png'}" alt="" onclick="sharewx()">
            </div>
            <div class="pic2 pic">

            </div>
            <!--  <div class="pic3 pic">
              <img src="../../images/allPic/weibo@2x.png" alt="">
            </div> -->
          </div>
        </div>`

        let footer =
          `<div class="footer-noconfirm" id='footer-noconfirm'  style="display:${isopencomment === '0' ? 'block' : 'none'}">
            <div class="comment">
              <img src="${configColorType === '1' ? '../../images/allPic/blackpinglun.png' : '../../images/allPic/dapinglun.png'}" alt="" onclick="commentFocus()">
            </div>
            <div class="praise">
              <img src="${configColorType === '1' ? '../../images/allPic/blackdianzan.png' : '../../images/allPic/danodianzan.png'}" alt="" data-status='1' style="display:${data.thumbsupStatus === '0' ? 'block' : 'none'}" onclick="zxupdatePriase2({'thumbupObjectId':'${data.infoId}','status':'${data.thumbsupStatus === '0' ? '1' : '0'}'},this)">
              <img src="../../images/allPic/dayidianzan.png" alt="" data-status='0' style="display:${data.thumbsupStatus === '1' ? 'block' : 'none'}" onclick="zxupdatePriase2({'thumbupObjectId':'${data.infoId}','status':'${data.thumbsupStatus === '1' ? '0' : '1'}'},this)">
            </div>
        </div>
        <div class="footer-confirm" id='footer-confirm' style="display:${isopencomment === '0' ? 'none' : 'block'};padding-left:0.4rem;" onclick="sendcomment()">发送</div>`

        $('.partTwo').append(partTwo)
        $('.partThree').append(partThree)
        $('.mainfooter').append(footer)
        // authInfo(data)
        // if (res.data.templateShareUrl) {
        //   templateShareUrl = res.data.templateShareUrl // 画报地址
        // } else {
        //   // console.log(res.data, 'res.data')
        //   getshareUrl(res.data)
        // }

        // zoomImg()
      } else {
        // jsBridge.toast('数据异常')
      }
    })
  }

  // function authInfo (data = {}) {
  //   const {characterInfos, advertisingUrl} = data
  //   let auth
  //   if (characterInfos) {
  //     characterInfos.forEach(function (ele) {
  //       if (!auth && ele && ele.characterDesc && ele.email) {
  //         auth = ele
  //         return
  //       }
  //     })
  //     if (!auth) { return }
  //     if (auth && auth.coverUrl) {
  //       $('.info-detail-auth').prepend(`
  //       <div class="info-auth-photo mr10">
  //         <img src="${auth.coverUrl}"></img>
  //       </div>`)
  //     } else {
  //       $('.info-detail-auth').prepend(`
  //       <div class="info-auth-photo mr10">
  //         <img src="../../images/details/default-auth-photo.png"></img>
  //       </div>`)
  //     }
  //     if (auth && auth.name) {
  //       $('.info-auth-content').append(`
  //       <p>
  //         <label>记者姓名：</label>
  //         <span>${auth.name}</span>
  //       </p>`)
  //     }
  //     if (auth && auth.email) {
  //       $('.info-auth-content').append(`
  //       <p class="line1">
  //         <label>邮箱：</label>
  //           <span>${auth.email}</span>
  //           <span class="auth-mark">通过邮件爆料</span>
  //       </p>`)
  //     }
  //     if (auth && auth.characterDesc) {
  //       characterDesc = auth.characterDesc
  //       $('.info-auth-content').append(`
  //       <p>
  //         <label>简介：</label>
  //           <span id='auth-character'>${characterDesc}</span>
  //       </p>`)
  //       textLimite(52)
  //     }
  //     if (advertisingUrl && advertisingUrl.paramValue && advertisingUrl.paramValue !== '0') {
  //       $('.info-detail-describe').append(`
  //       <div class="ta-center advertising">
  //         <img src="${advertisingUrl.paramValue}"></img>
  //       </div>`)
  //     }
  //   }
  // }

  // function textLimite (limit) {
  //   $('#auth-character').each(function () {
  //     let str = $(this).html()
  //     let subStr = str.substring(0, limit)
  //     $(this).html(
  //       subStr +
  //         (str.length > limit
  //           ? '...' + `<a href='javascript:;'>查看更多</a>`
  //           : '')
  //     )
  //   })
  //   $(document).on('click', '#auth-character', function(){
  //     if (characterDesc) {
  //       $('#auth-character').html(characterDesc)
  //     }
  //   })
  // }

  // function zoomImg() {
  //   let dom = $('.info-detail img')
  //   for(let i = 0; i < dom.length; i++){
  //     dom.eq(i).attr('src',dom.eq(i).attr('src').split('?')[0])
  //   }
  //   dom.click(function () {
  //     let obj = {}
  //     let fileList = []
  //     for (let i = 0; i < dom.length; i++) {
  //       obj = {}
  //       obj.url = dom.eq(i).attr('src')
  //       obj.width = dom.eq(i).width()
  //       obj.height = dom.eq(i).height()
  //       fileList.push(obj)
  //     }
  //     if(!$(this).parent().is('a')){
  //       jsBridge.getImgList({url: $(this).attr('src'), fileList: fileList})
  //     }
  //   })
  // }

  //获取相关推荐
  // function getRecommentList(params) {
  //   Server.recomendInfo.getRecomentList({'funcCode': params.funcCode, 'infoId': params.infoId}).then(res => {
  //     $('.info-detail-recommend-content ul').empty()
  //     if (res.code === 0) {
  //       let list = res.data.list
  //       if (list.length !== 0 || !list) {
  //         list.map((item, index) => {
  //           let creatTime = item.issuerDttm * 1000
  //           let nowTime = +new Date().valueOf()
  //           let year = new Date(creatTime).getFullYear()
  //           let month = new Date(creatTime).getMonth() + 1 < 10 ? '0' + (new Date(creatTime).getMonth() + 1) : new Date(creatTime).getMonth() + 1
  //           let day = new Date(creatTime).getDate() < 10 ? '0' + new Date(creatTime).getDate() : new Date(creatTime).getDate()
  //           let hour = new Date(creatTime).getHours() < 10 ? '0' + new Date(creatTime).getHours() : new Date(creatTime).getHours()
  //           let minute = new Date(creatTime).getMinutes() < 10 ? '0' + new Date(creatTime).getMinutes() : new Date(creatTime).getMinutes()
  //           if (nowTime - creatTime < 30 * 60 * 1000) {
  //             if (nowTime - creatTime < 1 * 60 * 1000) {
  //               item.issuerDttm = '刚刚'
  //             } else {
  //               item.issuerDttm = parseInt((nowTime - creatTime) / 1000 / 60) + '分钟前'
  //             }
  //           } else if (nowTime - creatTime < 24 * 60 * 60 * 1000) {
  //             if (nowTime - creatTime < 60 * 60 * 1000) {
  //               item.issuerDttm = '1小时前'
  //             } else {
  //               item.issuerDttm = parseInt((nowTime - creatTime) / 1000 / 60 / 60) + '小时前'
  //             }
  //           } else if (new Date().getDate() - new Date(creatTime).getDate() == 1 && new Date().getMonth() == new Date(creatTime).getMonth() && new Date().getFullYear() == new Date(creatTime).getFullYear()) {
  //             item.issuerDttm = '昨天' + hour + ':' + minute
  //           } else {
  //             item.issuerDttm = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
  //           }
  //         })

  //         list.map((v, i) => {
  //           let li =
  //             `<li onclick="reloadDetails({'infoId':'${v.infoId}','funcCode':'${v.funcCode}','infoType':'${v.infoType}'})">
  //                 <div class="content-left">
  //                   <div class="content-left-main" style="width:${v.coverImgUrl ? '4.52rem' : '100%'}">${v.mainTitle}</div>
  //                   <div class="content-left-litterText">
  //                     <span>${v.issuerDttm}</span>
  //                   </div>
  //                 </div>
  //                 <div class="content-right" style="display:${v.coverImgUrl ? 'block' : 'none'}">
  //                   <img src="${v.coverImgUrl}" alt="" class='content-right-img'>
  //                 </div>
  //               </li>
  //               <li class="solidLi"></li>`

  //           $('.info-detail-recommend-content ul').append(li)
  //         })
  //       } else {
  //         $('.info-detail-recommend').css('display', 'none')
  //       }
  //     } else {
  //       // jsBridge.toast('数据异常')
  //     }
  //   })
  // }

  //点击相关推荐获取新的详情数据(刷新页面获取最新的数据)
  function reloadDetails(params) {
    jsBridge.openWindow('/html/details/Information-details.html?infoId=' + params.infoId + '&infoType=' + params.infoType + '&funcCode=' + params.funcCode + '&isopencomment=0', {}, {noBar: false})
    //刷新上级H5页面的阅读数
    jsBridge.updateStatus({'type': 'refresh', 'name': 'refresh', 'infoId': commentObjectId, 'value': '1'})
  }

  //文章内部有goto方法内部跳转
  function goto(params1,params2) {
    if ('-2' === params2) {
      jsBridge.goToEnclosure({'url':params1})
    } else if ('-1' === params2) {
      jsBridge.openWindow(params1, {}, {noBar: true})
    } else {
      jsBridge.openWindow('/html/details/Information-details.html?infoId=' + params1 + '&infoType=1&funcCode=004001&isopencomment=0', {}, {noBar: false})
    }
  }

  //获取资讯详情页面的全部一级评论
  function getcomment(params) {
    Server.informationcommentList.getComment({'pageNum': params.pageNum, 'pageSize': 5, 'commentObjectId': params.infoId, 'datasource': '1'}).then(res => {
      if (res.code === 0) {
        $('.info-detail-comment-title').empty()
        let list = res.data
        let count = `<span>全部评论（${res.commentTotal}）</span>`
        $('.info-detail-comment-title').append(count)

        list.map((item, index) => {
          //修改时间
          let creatTime = item.createDttm * 1000
          let nowTime = +new Date().valueOf()
          let year = new Date(creatTime).getFullYear()
          let month = new Date(creatTime).getMonth() + 1 < 10 ? '0' + (new Date(creatTime).getMonth() + 1) : new Date(creatTime).getMonth() + 1
          let day = new Date(creatTime).getDate() < 10 ? '0' + new Date(creatTime).getDate() : new Date(creatTime).getDate()
          let hour = new Date(creatTime).getHours() < 10 ? '0' + new Date(creatTime).getHours() : new Date(creatTime).getHours()
          let minute = new Date(creatTime).getMinutes() < 10 ? '0' + new Date(creatTime).getMinutes() : new Date(creatTime).getMinutes()
          if (nowTime - creatTime < 30 * 60 * 1000) {
            if (nowTime - creatTime < 1 * 60 * 1000) {
              item.createDttm = '刚刚'
            } else {
              item.createDttm = parseInt((nowTime - creatTime) / 1000 / 60) + '分钟前'
            }
          } else if (nowTime - creatTime < 24 * 60 * 60 * 1000) {
            if (nowTime - creatTime < 60 * 60 * 1000) {
              item.createDttm = '1小时前'
            } else {
              item.createDttm = parseInt((nowTime - creatTime) / 1000 / 60 / 60) + '小时前'
            }
          } else if (new Date().getDate() - new Date(creatTime).getDate() == 1 && new Date().getMonth() == new Date(creatTime).getMonth() && new Date().getFullYear() == new Date(creatTime).getFullYear()) {
            item.createDttm = '昨天' + hour + ':' + minute
          } else {
            item.createDttm = year + '-' + month + '-' + day + ' ' + hour + ':' + minute
          }
        })

        list.map((v, i) => {
          let li =
            `<li onclick="gocomment('${v.userName}', '${v.commentId}')">
                  <div class='comstatus' style="display:${v.status === '2' ? 'block' : 'none'}">审核中</div>
                  <div class="comment-content-left">
                    <img src="${v.headUrl ? v.headUrl : '../../images/allPic/touxiang.png'}" alt="">
                  </div>
                  <div class="comment-content-right">
                    <div class="name">${v.userName}
                      <span style="display:${(v.isTop === '1') ? 'inline-block' : 'none'}" class="comment-isTop">精选</span>
                    </div>
                    <div class="explain">${v.content}</div>

                    <div class="litterIcon">
                      <div style="position:absolute;left:0;">
                        <span>${v.createDttm}</span>
                        <span style="margin-left: .25rem;" onclick="sendComment(event, '${v.userName}', '${v.commentId}')">回复</span>
                      </div>
                    </div>
                    <div class="secondcomment-seeAll" style="display:${(v.status === '1' && v.childCount !== 0) ? 'block' : 'none'}">
                      <span onclick="dosecondcomment(event, {'datasource':'1','isopencomment':'0','parentId':'${v.commentId}','commentObjectId':'${commentObjectId}'})">查看全部评论(${v.childCount})条></span>
                    </div>
                  </div>
                  <div class="comment-content-right-r">
                    <div style="display:${v.status === '2' ? 'none' : 'block'}" class="iconBox">

                      <span style='vertical-align:middle;'>
                        <img src="${configColorType === '1' ? '../../images/allPic/blackdianzan.png' : '../../images/allPic/nodianzan1.png'}" alt="" data-status='1' style="display:${v.ifThumbsup === '0' ? 'block' : 'none'}" onclick="commentPriase({'thumbupObjectId':'${v.commentId}','status':'${v.ifThumbsup === '0' ? '1' : '0'}'},this)">
                        <img src="../../images/allPic/yidianzan1.png" alt="" data-status='0' style="display:${v.ifThumbsup === '1' ? 'block' : 'none'}" onclick="commentPriase({'thumbupObjectId':'${v.commentId}','status':'${v.ifThumbsup === '1' ? '0' : '1'}'},this)">
                      </span>
                      <span style='vertical-align:middle;'>${v.thumbsupCnt}</span>
                    </div>
                  </div>
                </li>`
          $('.info-detail-comment-content ul').append(li)
        })
      } else {
        // jsBridge.toast('数据异常')
      }
    })
  }

  //点击文章内部点赞按钮（文章点赞）
  function zxupdatePriase1(params1, params2) {
    if (token) {
      let status = $(params2).attr('data-status')
      if (status === '1') {
        let num = $(params2).parent().next().text()
        $(params2).parent().next().text(+num + 1)
        $('.praise img').eq(0).hide().siblings().show()
      } else {
        let num = $(params2).parent().next().text()
        $(params2).parent().next().text(+num - 1)
        $('.praise img').eq(1).hide().siblings().show()
      }
      $(params2).hide().siblings().show()
      Server.realTimeInfo.updatePriase({'thumbupObjectId': params1.thumbupObjectId, 'datasource': '1', 'status': params1.status, 'objectSource': '1', 'source': '10'}).then(res => {
        if (res.code === 0) {
          // getinfoDetail({'infoId':commentObjectId,'infoType':infoType})
        } else if (res.code === -8) {
          // jsBridge.toast(res.data.msg)
          // jsBridge.openLogin()
          jsBridge.delData('token')
          token = ''
          jsBridge.toast('登录过期，请重新登录')
        }
      })
    } else {
      // jsBridge.toast('暂未登录,请先登录...')
      jsBridge.openLogin()
    }
  }

  //底部点赞按钮（文章点赞）
  function zxupdatePriase2(params1, params2) {
    if (token) {
      let status = $(params2).attr('data-status')
      if (status === '1') {
        $('.info-detail-content-footer-praise-box .box1 img').eq(0).hide().siblings().show()
        let num = $('.info-detail-content-footer-praise-box .box1').siblings().text()
        $('.info-detail-content-footer-praise-box .box1').siblings().text(+num + 1)
      } else {
        $('.info-detail-content-footer-praise-box .box1 img').eq(1).hide().siblings().show()
        let num = $('.info-detail-content-footer-praise-box .box1').siblings().text()
        $('.info-detail-content-footer-praise-box .box1').siblings().text(+num - 1)
      }
      $(params2).hide().siblings().show()
      Server.realTimeInfo.updatePriase({'thumbupObjectId': params1.thumbupObjectId, 'datasource': '1', 'status': params1.status, 'objectSource': '1', 'source': '1'}).then(res => {
        if (res.code === 0) {
          // getinfoDetail({'infoId':commentObjectId,'infoType':infoType})
        } else if (res.code === -8) {
          // jsBridge.openLogin()
          jsBridge.delData('token')
          token = ''
          jsBridge.toast('登录过期，请重新登录')
        }
      })
    } else {
      // jsBridge.toast('暂未登录,请先登录...')
      jsBridge.openLogin()
    }
  }

  //点击评论里面的点赞按钮
  function commentPriase(params1, params2) {
    event.stopPropagation()
    if (token) {
      let status = $(params2).attr('data-status')
      if (status === '1') {
        let num = $(params2).parent().next().text()
        $(params2).parent().next().text(+num + 1)
      } else {
        let num = $(params2).parent().next().text()
        $(params2).parent().next().text(+num - 1)
      }
      $(params2).hide().siblings().show()
      Server.realTimeInfo.updatePriase({'thumbupObjectId': params1.thumbupObjectId, 'datasource': '1', 'status': status, 'objectSource': '1', 'source': ''}).then(res => {
        if (res.code === 0) {
          // getcomment({'infoId':commentObjectId})
        } else if (res.code === -8) {
          // jsBridge.toast(res.data.msg)
          // jsBridge.openLogin()
          jsBridge.delData('token')
          token = ''
          jsBridge.toast('登录过期，请重新登录')
        }
      })
    } else {
      // jsBridge.toast('暂未登录,请先登录...')
      jsBridge.openLogin()
    }
  }

  //点击底部的收藏按钮
  function updateCollect(params1, params2) {
    if (token) {
      let status = $(params2).attr('data-status')
      $(params2).hide().siblings().show()
      Server.realTimeInfo.updateCollectdata({'collectionObjectId': params1.collectionObjectId, 'datasource': '1', 'status': status, 'objectSource': '1'}).then(res => {
        if (res.code === 0) {
          // getinfoDetail({'infoId':commentObjectId,'infoType':infoType})
        } else if (res.code === -8) {
          // jsBridge.toast(res.data.msg)
          // jsBridge.openLogin()
          jsBridge.delData('token')
          token = ''
          jsBridge.toast('登录过期，请重新登录')
        }
      })
    } else {
      // jsBridge.toast('暂未登录,请先登录...')
      jsBridge.openLogin()
    }
  }

  //点击播放按钮播放音频和暂停播放音频
  function playvioce(params1) {
    if (params1.voiceUrl) {
      $('.info-detail-no-play').hide()
      $('.info-detail-no-play').eq(1).show()
      jsBridge.openInfoVoice({
        'voiceUrl': params1.voiceUrl,
        'mainTitle': params1.mainTitle,
        'infoType': params1.infoType,
        'infoId': params1.infoId,
        'coverImgUrl': params1.coverImgUrl
      })
    }
  }

  function ztplayvioce() {
    jsBridge.closeInfoVoice()
    $('.info-detail-no-play').hide()
    $('.info-detail-no-play').eq(0).show()
  }

  //获取底部评论的状态
  function footerStatus(params) {
    // $('.mainfooter').empty()

  }

  //点击评论小图标
  function commentFocus() {
    if (isComment === '0') {
      return false
    } else {
      $('.commentInpt').focus()
    }
  }
  function stopPropagation(e) {
    e = e || window.event
    if(e.stopPropagation) { //W3C阻止冒泡方法
      e.stopPropagation()
    } else {
      e.cancelBubble = true //IE阻止冒泡方法
    }
  }
  // 评论回复
  function sendComment (event, username, pid) {
    // console.log(event)
    // token = '3de7dae4593ccf0d86b0a6230fb23e99'
    if(token){
      parentId = pid
      // console.log('parentId', parentId, pid)
      level = 2
      $('.level1 .commentInpt').attr('placeholder', '回复' + username)
      isopencomment = '1'
      $('.level1 .commentInpt').focus()
    }else{
      // jsBridge.toast('暂未登录，请先登录...')
      jsBridge.openLogin()
    }
  }
  //点击发送按钮
  function sendcomment() {
    // token = '3de7dae4593ccf0d86b0a6230fb23e99'
    if (token) {
      let content = $('.commentInpt').val()
      if (content === '') {
        jsBridge.toast('内容不为空')
      } else {
        Server.informationcommentList.addcomment({'parentId': level == 2 ? parentId : '0', 'commentObjectId': commentObjectId, 'content': content, 'datasource': '1', 'objectSource': '1'}).then(res => {
        // Server.informationcommentList.addcomment({'parentId': level == 2 ? parentId : '0', 'commentObjectId': '4a032d3e898d49e8b31b2c3a86812fff', 'content': content, 'datasource': '1', 'objectSource': '1'}).then(res => {
          if (res.code === 0) {
            // jsBridge.toast('评论成功')
            jsBridge.toast('评论成功，审核通过后将展示在评论区哦~')
            $('.commentInpt').val('')
            $('.commentInpt').attr('placeholder', '请说说你的看法...')
            $('.info-detail-comment-content ul').empty()
            pageNum = 1
            getcomment({'infoId': commentObjectId, 'pageNum': pageNum})
            $('.commentInpt').blur()
            level = 1
          } else if (res.code === -8) {
            // jsBridge.toast('数据异常')
            jsBridge.delData('token')
            token = ''
            jsBridge.toast('登录过期，请重新登录')
          }
        })
      }
    } else {
      // jsBridge.toast('暂未登录,请先登录...')
      jsBridge.openLogin()
    }
  }

  //input框聚焦失焦,加定时器确保点击事件先触发
  $('.commentInpt').blur(function () {
    setTimeout(function () {
      $('#footer-noconfirm').show()
      $('#footer-confirm').hide()
    }, 100)
    $('.commentInpt').attr('placeholder', '请说说你的看法...')
    isopencomment = '0'
  })
  $('.commentInpt').focus(function () {
    setTimeout(function () {
      $('#footer-noconfirm').hide()
      $('#footer-confirm').show()
    }, 100)
  })

  //从资讯详情页的评论点击回复做二级评论,唤起输入框
  function dosecondcomment(e, params) {
    if(e.stopPropagation) { //W3C阻止冒泡方法
      e.stopPropagation()
  } else {
      e.cancelBubble = true //IE阻止冒泡方法
  }
    // event.preventDefault()
    // console.log('二级')
    if (token) {
      jsBridge.openWindow('/html/comment/commentdetails.html?parentId=' + params.parentId + '&datasource=1' + '&isopencomment=' + params.isopencomment + '&commentObjectId=' + params.commentObjectId, {}, {noBar: false})
    } else {
      // jsBridge.toast('暂未登录，请先登录...')
      jsBridge.openLogin()
    }
  }

  //去评论详情页但是不换起输入框
  function gocomment(username, pid) {
    console.log('点击了父元素')
    if(token){
      parentId = pid
      level = 2
      $('.level1 .commentInpt').attr('placeholder', '回复' + username) // ;val('@'+username+' ')
      isopencomment = '1'
      $('.level1 .commentInpt').focus()
    }else{
      // jsBridge.toast('暂未登录，请先登录...')
      jsBridge.openLogin()
    }
  }


  //点击返回按钮
  function closeWindow() {
    jsBridge.closeWindows()
  }

  //滑动加载下一页
  document.addEventListener('scroll', function () {
    if (isComment === '0') {
      let scroll = $(document).scrollTop()
      //头部显示主标题
      if (scroll !== 0) {
        let title = $('.info-detail-content-title span').text()
        $('.header-title').text(title)
      } else {
        $('.header-title').text('')
      }
      return false
    } else {
      //翻页
      let top = $('.info-detail-comment').offset().top
      let height = $('.info-detail-comment').height() + 16
      let maxHeight = document.body.offsetHeight
      let scroll = $(document).scrollTop()
      //头部显示主标题
      if (scroll !== 0) {
        let title = $('.info-detail-content-title span').text()
        $('.header-title').text(title)
      } else {
        $('.header-title').text('')
      }

      if (Math.round(top + height + 50 - maxHeight) === Math.round(scroll)) {
        pageNum++
        getcomment({'infoId': commentObjectId, 'pageNum': pageNum})
      }
    }
  })

  //分享
  function goShare() {
    // console.log('url', templateShareUrl)
    event.stopPropagation()
    // jsBridge.toast('敬请期待')
    Server.infoShare.share({'infoId': commentObjectId, 'datasource': '1', 'objectSource': '1'}).then(res => {
      if (res.code === 0) {
        // let count  = $(params2).next().text()
        // $(params2).next().text(+count+1)
      }
    })
    //分享
    jsBridge.share({
      'scene': '0,1',
      'type': 'url',
      'url': shareUrl + '/html/details/financial-news-details.html?infoId=' + commentObjectId + '&infoType=' + infoType + '&funcCode=' + funcCode,
      'title': sharetitle ? sharetitle.replace(/&nbsp;/g, '') : '',
      'content': sharecontent ? sharecontent.replace(/&nbsp;/g, '') : '',
      'image': shareImgUrl ? shareImgUrl : '', // 分享图
      'templateShare': '0', // 是否画报分享
      'templateShareUrl': templateShareUrl,
      'infoId': commentObjectId,
      'templateId': templateId
    })
  }

  //点击文章里面的分享微信或者分享朋友圈
  function sharewx() {
    jsBridge.share({
      'scene': '0',
      'type': 'url',
      'url': shareUrl + '/html/details/financial-news-details.html?infoId=' + commentObjectId + '&infoType=' + infoType + '&funcCode=' + funcCode,
      'title': sharetitle ? sharetitle.replace(/&nbsp;/g, '') : '',
      'content': sharecontent ? sharecontent.replace(/&nbsp;/g, '') : '',
      'image': shareImgUrl ? shareImgUrl : ''
    })
  }

  function sharepyq() {
    jsBridge.share({
      'scene': '1',
      'type': 'url',
      'url': shareUrl + '/html/details/financial-news-details.html?infoId=' + commentObjectId + '&infoType=' + infoType + '&funcCode=' + funcCode,
      'title': sharetitle ? sharetitle.replace(/&nbsp;/g, '') : '',
      'content': sharecontent ? sharecontent.replace(/&nbsp;/g, '') : '',
      'image': ''
    })
  }
</script>
</html>
